fsnotify: Add group pointer in fsnotify_init_mark()

Currently we initialize mark->group only in fsnotify_add_mark_lock().
However we will need to access fsnotify_ops of corresponding group from
fsnotify_put_mark() so we need mark->group initialized earlier. Do that
in fsnotify_init_mark() which has a consequence that once
fsnotify_init_mark() is called on a mark, the mark has to be destroyed
by fsnotify_put_mark().

Reviewed-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
Jan Kara
2016-12-21 18:32:48 +01:00
parent ebb3b47e37
commit 7b12932340
8 changed files with 38 additions and 32 deletions

View File

@@ -103,15 +103,16 @@ struct audit_fsnotify_mark *audit_alloc_mark(struct audit_krule *krule, char *pa
goto out;
}
fsnotify_init_mark(&audit_mark->mark, audit_fsnotify_free_mark);
fsnotify_init_mark(&audit_mark->mark, audit_fsnotify_group,
audit_fsnotify_free_mark);
audit_mark->mark.mask = AUDIT_FS_EVENTS;
audit_mark->path = pathname;
audit_update_mark(audit_mark, dentry->d_inode);
audit_mark->rule = krule;
ret = fsnotify_add_mark(&audit_mark->mark, audit_fsnotify_group, inode, NULL, true);
ret = fsnotify_add_mark(&audit_mark->mark, inode, NULL, true);
if (ret < 0) {
audit_fsnotify_mark_free(audit_mark);
fsnotify_put_mark(&audit_mark->mark);
audit_mark = ERR_PTR(ret);
}
out: