[07/10] audit: Remove pointless check in insert_hash()
diff mbox

Message ID 20180710100217.12866-8-jack@suse.cz
State New
Headers show

Commit Message

Jan Kara July 10, 2018, 10:02 a.m. UTC
The audit_tree_group->mark_mutex is held all the time while we create
the fsnotify mark, add it to the inode, and insert chunk into the hash.
Hence mark cannot get detached during this time and so the check whether
the mark is attached in insert_hash() is pointless.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 kernel/audit_tree.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Paul Moore July 27, 2018, 4:47 a.m. UTC | #1
On Tue, Jul 10, 2018 at 6:02 AM Jan Kara <jack@suse.cz> wrote:
>
> The audit_tree_group->mark_mutex is held all the time while we create
> the fsnotify mark, add it to the inode, and insert chunk into the hash.
> Hence mark cannot get detached during this time and so the check whether
> the mark is attached in insert_hash() is pointless.
>
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  kernel/audit_tree.c | 2 --
>  1 file changed, 2 deletions(-)

This makes sense.

--
paul moore
www.paul-moore.com

Patch
diff mbox

diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index f419fdfc25b4..b7977cf30479 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -184,8 +184,6 @@  static void insert_hash(struct audit_chunk *chunk)
 {
 	struct list_head *list;
 
-	if (!(chunk->mark.flags & FSNOTIFY_MARK_FLAG_ATTACHED))
-		return;
 	/*
 	 * Make sure chunk is fully initialized before making it visible in the
 	 * hash. Pairs with a data dependency barrier in READ_ONCE() in