From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 170A2C4332F for ; Mon, 14 Feb 2022 09:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245374AbiBNJrY (ORCPT ); Mon, 14 Feb 2022 04:47:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245111AbiBNJpu (ORCPT ); Mon, 14 Feb 2022 04:45:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCBD160D96; Mon, 14 Feb 2022 01:38:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FEBD6118F; Mon, 14 Feb 2022 09:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37491C340EF; Mon, 14 Feb 2022 09:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644831519; bh=0SNWPaXymZm3bX46jRXr1RWWCMk24h+5vqzYav0VjV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=juo4RSE8Fugx8Vv2djVsATPlXRL0kWfbS+bQ8X42Es8fxPpXrwTHLGEHzYhpO3Yz3 /z/HYZpWXjIlGr+Mlm43WoLIjk3ZyioSUDG4/OZdT/pUx+2tRZNu2R6yriC0zvQSUW JfZijHqLghTz83arXi7zaXNK9upKpqk/elvNSOXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Paul Moore , Mimi Zohar Subject: [PATCH 5.10 001/116] integrity: check the return value of audit_log_start() Date: Mon, 14 Feb 2022 10:25:00 +0100 Message-Id: <20220214092458.722049185@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092458.668376521@linuxfoundation.org> References: <20220214092458.668376521@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaoke Wang commit 83230351c523b04ff8a029a4bdf97d881ecb96fc upstream. audit_log_start() returns audit_buffer pointer on success or NULL on error, so it is better to check the return value of it. Fixes: 3323eec921ef ("integrity: IMA as an integrity service provider") Signed-off-by: Xiaoke Wang Cc: Reviewed-by: Paul Moore Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- security/integrity/integrity_audit.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c @@ -45,6 +45,8 @@ void integrity_audit_message(int audit_m return; ab = audit_log_start(audit_context(), GFP_KERNEL, audit_msgno); + if (!ab) + return; audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", task_pid_nr(current), from_kuid(&init_user_ns, current_uid()),