Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2227984imm; Mon, 28 May 2018 04:20:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqDEzRI4jUXyiha8Srt+CrV3/wOVlpC5ay/U4he/YvIrnKUmaFjeuijM37pKQ0IEQpHV7iG X-Received: by 2002:a17:902:bd98:: with SMTP id q24-v6mr10370491pls.105.1527506449735; Mon, 28 May 2018 04:20:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527506449; cv=none; d=google.com; s=arc-20160816; b=MqJkD4Iwe7GadrneMFa2X+vkGCXzFZB0u6h/UjMPmeFL/Buy3VztNr3O1WiU0zCr4l 5jmnJ5O1cdCwH7afvWgVkfbafZ13y8N4Htt4FnByuqgmhsMUR0dWtVmyja77SIhV/b8u WUaOlVbDqtlt6pA39NnlxP6QeWAFjxJsPuc6fqEoLLGXmMihIReCAA9G0pL7grv6sXBM HrJPX5DG1mxJj5yxQ698FlY0wY/4di4gXxpRGpXKzv88p/p0vID9/MSuxgwKZh8LTZ6J Um3GWQJDmH8Yax1FwG8cbvQCbhDkreo+Rpnmt841SJ6lclfl7CU4d8eI+Tn3LcfQDhmm 5Ybg== 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=lgBhkLQCFA6UFN789jbL5eiLXzQfRqqDWVdMCBNrS9g=; b=ffKZz2UIhfgn0XRIOmdKNH/1l6/8KXO8q9axdhZfmQLDU7tqRP8Cd7skFi82s3M+0V EE6kupxifH51sDidxGcDj5sol9KufunE0z/U8cXyr8LgoZKcr7dt1qOO/Lpck32TN4hv FnkWRVSUrbzpqFkV9qszaNEkt9lPi/zyefFt3AXDraKBbknau4ELUiL4QtNDkrbgpAO1 RI+ixGZvD6Hej2swbdI5PMAvwgOsOhXn3kW9MmXq6pc33hrttDoSjJKwkB0eWuQTT3Az Dl48Ckwz9YN8jadMgBj21o9C6nZdUSUzhtbH/bqg8IhVCZJLLyxlixYP3BJqEqiiHnqc I7gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=br2DV/7r; 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 i15-v6si10999713pgr.566.2018.05.28.04.20.35; Mon, 28 May 2018 04:20:49 -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=br2DV/7r; 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 S1424734AbeE1LSv (ORCPT + 99 others); Mon, 28 May 2018 07:18:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:35512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424700AbeE1LQe (ORCPT ); Mon, 28 May 2018 07:16:34 -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 7FB0F2089E; Mon, 28 May 2018 11:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527506194; bh=TQpTBRof7UX4mAISBMEv8EOwSo2NW/Z9iDlKV68Rw8s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=br2DV/7rv6Ifyw2D6QYDrXYIl3H1dDy7LcI4lV5dtzI4ygH1ePV/kAqMWoqhYklAd eHcNtEB/vR/zXvePqTQhoFOmCvQ+428asUqtWSmhEbDa/qnd9YKxcDGrt26+85xnHK k2dpDuvj0xBGMvCTx4RVHFanVw/V53Rk9xbecGzE= 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 4.16 239/272] audit: return on memory error to avoid null pointer dereference Date: Mon, 28 May 2018 12:04:32 +0200 Message-Id: <20180528100300.419192495@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100240.256525891@linuxfoundation.org> References: <20180528100240.256525891@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 4.16-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 @@ -1058,6 +1058,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,