From patchwork Wed Oct 19 08:25:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp349436wrs; Wed, 19 Oct 2022 07:11:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6kz6tcZlIXNcL+Eo62MQ8u6UE8w99emiJhH9XbnI1vKH1rntBizPixqtX85BXq6IDjQT1p X-Received: by 2002:a05:6a00:1501:b0:563:9f05:bd6e with SMTP id q1-20020a056a00150100b005639f05bd6emr8856766pfu.48.1666188707222; Wed, 19 Oct 2022 07:11:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188707; cv=none; d=google.com; s=arc-20160816; b=z6OUwHreIKvESy3WZoaJ3jqhTu3f19GuSifTMcw4pAbHj//qKSYAptRjw9M0K520gh iLe+P7rxnpFm5g1CB5nIKagseWNmx1WyWxHR3viARSF7WYeW9oTln/P9KfRIt9oVFthZ +GsHejH5LXAdYVUuTD4FlhIGV3pxmDUJ/0aa4hQK3IfHcf4FjIwnFtkJw6rcORcdMZ97 DByfLsJor8x3eyv/tKDsKUcRNPEcJrklrEKPUFHq1HbdMPSHN7yB/UHNPGf8pJrYb5pq 0ibMZv3Ed5mjw5X8iFdy5UY5kOgM8eXJuB1JsE4XHNfmmbM2TwTyVJFKNdFSe+0P0V/h k03Q== 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=Z/LrEgVC6zAP0NpbV4RTUvfot8G25uycp17CrnatObA=; b=Vf9SHsdJw/dGShN/3UtonwgNj0D3BmM0plb6eJauf9se9S7amlw/z6lZiQzNHc3yBR PRxd261zI2yGL/FGaUxOuoSv2UqyobLOMoYUMduSMPZzs5kz/xwIzIwoQtMlwqvW/UMa 5LUN4YWZL/avdQfPRroaNdDQgz22oscWnlEb4yLAfgWbM0aEG4dd4yYJKCl5Eaa8o6lR k/OTUtRVpmBnMrhraoMIPq929BQKDXf+i67OeDZVLECfpPcVSuqMETaSw3Wtk01lsJC2 t8TptiFq+ZlkM3StuCtOcUANTaqmzi3vtdvO84OsdbIfLmPVdjaSTAUWsoyHVjHU3jvM J3eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=stb10XTR; 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 y124-20020a636482000000b0042bb607f75esi17808018pgb.284.2022.10.19.07.11.09; Wed, 19 Oct 2022 07:11:47 -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=stb10XTR; 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 S233317AbiJSN4l (ORCPT + 99 others); Wed, 19 Oct 2022 09:56:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233819AbiJSNyG (ORCPT ); Wed, 19 Oct 2022 09:54:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E1761C5A58; Wed, 19 Oct 2022 06:36:45 -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 ams.source.kernel.org (Postfix) with ESMTPS id 32C73B82327; Wed, 19 Oct 2022 08:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88A8FC433C1; Wed, 19 Oct 2022 08:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169354; bh=7MyABJGgUTVSou116WehLBxh9mUqA3bxD8cDImHoQxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=stb10XTR6pKiPLDL1ovNwS9eXeOjWHggtwkTTPyljPfT3uYkCpivsOp4HKM9Ory3s uvqalHwHbFI14xUTT60wBGnq9j262L2CHnHRT1aHQY2AEbpUar7AtjMKPITb8VIM0+ pF9YH8TBPmUqeYMc4bwYlZTzqyccSZ1j7OWaPHjI= 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 6.0 246/862] audit: explicitly check audit_context->context enum value Date: Wed, 19 Oct 2022 10:25:33 +0200 Message-Id: <20221019083300.892749573@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747125489480079810?= X-GMAIL-MSGID: =?utf-8?q?1747125489480079810?= 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 79a5da1bc5bb..0ee09447ad04 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2069,7 +2069,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();