From patchwork Sat Oct 22 07:21:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7286 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092283wrr; Sat, 22 Oct 2022 00:53:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM451gWnlGQX5ufaqHDfJtEHkNfnO3kL8MwUj1zgZvoB2CFAvbvrlxPHcteH0jAWFxYYOOHO X-Received: by 2002:a17:902:724c:b0:177:5080:cbeb with SMTP id c12-20020a170902724c00b001775080cbebmr23210828pll.67.1666425220103; Sat, 22 Oct 2022 00:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425220; cv=none; d=google.com; s=arc-20160816; b=iQN2dTPvfa+jgjvm6aPFXDsIiu0gSpzbPqPRrMz3uSxMs1JQCnivzApmTO0sLNhwwP xaYik/qEdjCex0Dq7wn8uxELZK07ApI7i5gjT9aIpisFR7Zihyb3emrgC5/cYlXRdoW/ mKQtjbRebETWDkXlAY619Ces48DqgIFk2uZu5Pl45UJUUwrO3/eilGR4VrFd5QYx9Tv+ MTNL3FOuOPauYwvL4AFCSPnj1XxibDhfig0GEw8j//PHznkQ05Ek1m3GJWDqcPbhe487 HUbToJ1KMB7Wsuk93grpZWSLAWLX+gn9f/Gm9Gt+gk3JqRtbSE/dPhbmjw4dLJtkWHgn iycw== 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=/BOH7xV6fsPN3ShSHLoJ5AZvoOimEkJD1T9cEsCleG0=; b=t1NVKXEATFW1n8Fs9Osp1030UHrAeiZhatgYnjFCWEtCcK55Ob+L4kP5N2F28yZh+b Xw6IcZCWUvjpNfy5wNJrGaW9E2jxGKdiobOsAvWWD2WplkfVkj4tLxqBPlTQ68PBdUlF FIrJmOSzv2Zttrgn1CXhuBbyS48SOR2DEbzW6Zpxzk4vkQwNqZ+kvheob0GFsmWtVabG BEY+/KFJCpYYbp2MahN3KmVAtGf8rB7rdXCDO3fz0JnkNpRHnnYd3ltR0T/KjGzRjgO/ DRG+hpv5mTMqFjsTWBr4XrOivHxsR6GYCHRuI8ScXWfyD44dLGIB+N4xciAfCVKy5y6e Wg0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vzLBwBKJ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f20-20020a056a0022d400b0052f60f7e0bcsi31021079pfj.346.2022.10.22.00.53.27; Sat, 22 Oct 2022 00:53:40 -0700 (PDT) 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=vzLBwBKJ; 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 S231966AbiJVHxL (ORCPT + 99 others); Sat, 22 Oct 2022 03:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231717AbiJVHue (ORCPT ); Sat, 22 Oct 2022 03:50:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6212C2ACB; Sat, 22 Oct 2022 00:46:20 -0700 (PDT) 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 A11F760B0A; Sat, 22 Oct 2022 07:43:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B056FC433D6; Sat, 22 Oct 2022 07:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424611; bh=Kb5ALKjzG/7/M7Lz6XgmAsT3pLBjYGXRI1M5hmOz0JI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzLBwBKJ4iPKUL08UjWCyk26IRBISe+M0sWWXsApXSOv9t+sSa0qSqDOOSbPuMfSI fdWRYFT8QFrZdIML88eGOdgWxlI7vTIVvrE5qd58iUN2l8vt0BjR1Ynnhu3A3Zzc51 F+Z4gtMYaiK7jChWCOc0l4LUJjlIpcBkolRgBQps= 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 5.19 211/717] audit: explicitly check audit_context->context enum value Date: Sat, 22 Oct 2022 09:21:30 +0200 Message-Id: <20221022072452.598694575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373491286757759?= X-GMAIL-MSGID: =?utf-8?q?1747373491286757759?= From: Richard Guy Briggs [ Upstream commit 3ed66951f952ed8f1a5d03e171722bf2631e8d58 ] Be explicit in checking the struct audit_context "context" member enum value rather than assuming the order of context enum values. Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling contexts beyond syscalls") Signed-off-by: Richard Guy Briggs Signed-off-by: Paul Moore Signed-off-by: Sasha Levin --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 0c33e04c293a..65d816cda5df 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2094,7 +2094,7 @@ void __audit_syscall_exit(int success, long return_code) /* run through both filters to ensure we set the filterkey properly */ audit_filter_syscall(current, context); audit_filter_inodes(current, context); - if (context->current_state < AUDIT_STATE_RECORD) + if (context->current_state != AUDIT_STATE_RECORD) goto out; audit_log_exit();