Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2175804imm; Mon, 28 May 2018 03:15:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrtLJIQZ38+uR+AOObzYUg84CzUSN1XIJFDkr2e8G64gyXY2h0uXPnF0Whs9+tYQwWiIjsK X-Received: by 2002:a63:5fc4:: with SMTP id t187-v6mr9874044pgb.183.1527502546081; Mon, 28 May 2018 03:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527502546; cv=none; d=google.com; s=arc-20160816; b=ox8aDJy+rTmuB4x52BWBxZG/GvNHvFrDvin1tlxX0wnRC47AFTTLwm0W/pYzNrii1C FJiQPY5DK9dNIsQq4kJBfhV1FfSkbyA0Pj81susPHAtByY0egkA1vcz9ze0/q+ZvMZmg ILsNZJ9f9P9j2HfFZE8AAbKurgZIOTiPERGM1A58t/7D9QYjqVvnN3IpeDVLOsZQhkA1 z4Ykw3aOrq0D2BXxf1EDQgfGeBC+5z59WoLi1s0Y2cdJRQnIfkfPlymfs2UP5ReuhYcd rYxLJ4rqZjTnq44qfm69KlQl0iblZB2TrRDQMFM4X7YFRY1vDHkT6LBprw08pXHbhQHh A0ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=KF5D+Pxns88UyKmAYmqfeQmyxJ1s+XeF8HfqL58VNcA=; b=Ld7jaFdTfpG+AGKQnHeW/063IRUInE23+tSYLr4iSMaLSgxLwWKWus/AQl80HqRE0A Vfu8BgPfziBtITgXTEuNmpzo81kW1KA96ApJd0VpI4/gfZeJ9+bjUhjeb1VwSShb0pbB 8Nu8kXFGEjfJpVtRi/TmEtMOXh8+pvrIkaP/GcJ3iFrqP5qlCzgPNn0sMTpOqRGtEyy7 LZyhSHwzILdRadAnnRvTQWN7hA1gBoOUOk2tquS+QOZ9AqeScUkgMQs5M8si9dX+YFiy CGQZjU0jlDEbrLYlujmQCszuKQ6DTeSex1SXaYVNPg7vt+/WwTyk/LxR1ABjfz1qmwRQ 5tBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ze87+g/7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15-v6si31128998pfk.82.2018.05.28.03.15.31; Mon, 28 May 2018 03:15:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ze87+g/7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965798AbeE1KOV (ORCPT + 99 others); Mon, 28 May 2018 06:14:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:34242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934993AbeE1KOQ (ORCPT ); Mon, 28 May 2018 06:14:16 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 557D220843; Mon, 28 May 2018 10:14:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502455; bh=9GNUf6lETlf9ZsbDr7pY/HQd56qehwL0kJJpO/TiJq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ze87+g/7KbMO9kBH9r+GsfLl38kthKOjpH+xfCBdq+VroIRjzUJLzBNqbfArDuICx wLBks0Xks5FvP/MdVCfEGHkgWqDP3FUANIcTtR2TlQhavIhwdEf7a/36IqAzIY1oFi wcZ5ZiVPhsNPANHdFjU/JjCK+KFfn74aZ1Ubh6l0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Richard Guy Briggs , Paul Moore , Sasha Levin Subject: [PATCH 3.18 179/185] audit: return on memory error to avoid null pointer dereference Date: Mon, 28 May 2018 12:03:40 +0200 Message-Id: <20180528100115.895475498@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Richard Guy Briggs [ Upstream commit 23138ead270045f1b3e912e667967b6094244999 ] If there is a memory allocation error when trying to change an audit kernel feature value, the ignored allocation error will trigger a NULL pointer dereference oops on subsequent use of that pointer. Return instead. Passes audit-testsuite. See: https://github.com/linux-audit/audit-kernel/issues/76 Signed-off-by: Richard Guy Briggs [PM: not necessary (other funcs check for NULL), but a good practice] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- kernel/audit.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/audit.c +++ b/kernel/audit.c @@ -738,6 +738,8 @@ static void audit_log_feature_change(int return; ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); + if (!ab) + return; audit_log_task_info(ab, current); audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", audit_feature_names[which], !!old_feature, !!new_feature,