Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5749247pxb; Mon, 14 Feb 2022 06:48:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNQMMupwwlf2XEMs3cbznzjdnPTkU1/rLjN4vFgbtn8xCygyqTohUD/QfS085ekX6SdvVy X-Received: by 2002:a17:90b:3b42:: with SMTP id ot2mr15266495pjb.147.1644850116356; Mon, 14 Feb 2022 06:48:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644850116; cv=none; d=google.com; s=arc-20160816; b=RSEa23xAkJnAypq3vx19gT/m8wtNofXu2F7/iDlKFGMhZgDAPMbmMWNmwKfqlg70eH F0QGrcL3ASAN70+FnsUsbVOaNRInZagnJXz6XfMZtPpyRlGDIbyE2AbsqYAQrRRXllir BpcAUqej81Bea6UWfSE4hfEAgWOA5K/iimA0Y2P+3OaeeHO8346v0FMKwTGjUsZBxyCJ xR3U7h9lSIgSaHNqSNeQ5JSsICGcicPv2ZgR92HiWwQtH3xXAI90Ba0N7jAvCZ3UL8pm Pf9TR2x3VH/m50SBRPtXj7IMrhxpXLKZF6R3Ua9nrQQy0oOdhRaXoX7DGAXPKJ17gv8D Eilw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XMx/ry7PGSaSloiBRU5Nysc+eRdv8mmHFMti+Sux+Lw=; b=v+gTaEg9CHSe48B0+LY/5IBKxrC8pXpWaDdr35ijk53VdHyMz7GAyGPTO49MTEQ0uk pGqenjoQdwbo65PeRPKWwvJ28+S6rHjKxL//fxMCBka+RgJfNjW7BXQg7kQMtTUWNkQb OG0NoiMkioe6HU+qaL0JklIS12TRbsjZSm79LA7/P8i4pNEymhNFiXPOdA6MYY5ng9WO O/6LO67sqiIZTLDMrTRxld7LZMsBMJEeaZC+Mtt2OhWsUZxaJt1x7mBiQtvcn6pjAQTP UqcSY58XcmrZlC/JG1pkL5bftn56ibeqq4BSgts0u53NaF7ATMPNf2a+weUqN/+bFSPE Of3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=juo4RSE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p15si12383309plo.507.2022.02.14.06.48.16; Mon, 14 Feb 2022 06:48:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=juo4RSE8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245353AbiBNJrV (ORCPT + 99 others); Mon, 14 Feb 2022 04:47:21 -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 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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()),