]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
audit: explicitly check audit_context->context enum value
authorRichard Guy Briggs <rgb@redhat.com>
Thu, 25 Aug 2022 19:32:38 +0000 (15:32 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Oct 2022 10:38:04 +0000 (12:38 +0200)
[ 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 <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/auditsc.c

index 79a5da1bc5bb694f8a72d01d785ee387378c7194..0ee09447ad0472d75c5c14dbbb283033e61084c9 100644 (file)
@@ -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();