Skip to contentSkip to conversation

audit: remove redundant 'fsnotify_put_mark'

PATCH In review Wu Bo 1 participant 2 messages Sep 7, 2023 Audit

lore
Share & tools
lore

Wu Bo

author
#0 lore raw

PATCH 1/1 audit: remove redundant 'fsnotify_put_mark'

'fsnotify_add_inode_mark' has done 'fsnotify_put_mark' if error occurred. So here to call 'fsnotify_put_mark' is redundant.

---
 kernel/audit_fsnotify.c | 1 -
 1 file changed, 1 deletion(-)
kernel/audit_fsnotify.c +0 -1
index c565fbf66ac8..ff1cdda27653 100644
@@ -103,7 +103,6 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
 	ret = fsnotify_add_inode_mark(&audit_mark->mark, inode, 0);
 	if (ret < 0) {
 		audit_mark->path = NULL;
-		fsnotify_put_mark(&audit_mark->mark);
 		audit_mark = ERR_PTR(ret);
 	}
 out:
Signature · 1 line
2.35.3
author
#1 lore raw

Sorry, pls ignore this patch.
I misunderstood the difference between 'audit_alloc_mark' & 'audit_init_parent'. 'fsnotify_put_mark' in 'fsnotify_add_mark_locked' is pair to 'fsnotify_get_mark'

Quoted 23 lines · Wu Bo

'fsnotify_add_inode_mark' has done 'fsnotify_put_mark' if error occurred. So here to call 'fsnotify_put_mark' is redundant.

---
 kernel/audit_fsnotify.c | 1 -
 1 file changed, 1 deletion(-)
kernel/audit_fsnotify.c +0 -1
index c565fbf66ac8..ff1cdda27653 100644
@@ -103,7 +103,6 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
 	ret = fsnotify_add_inode_mark(&audit_mark->mark, inode, 0);
 	if (ret < 0) {
 		audit_mark->path = NULL;
-		fsnotify_put_mark(&audit_mark->mark);
 		audit_mark = ERR_PTR(ret);
 	}
 out:
Signature · 1 line
2.35.3