diff options
author | Jan Kara <jack@suse.cz> | 2016-12-21 12:32:48 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2017-04-10 11:37:36 -0400 |
commit | 7b1293234084ddb6469c4e9a5ef818f399b5786b (patch) | |
tree | 0b54695cc96dd0a17c893bcd7743f9aea84d5ce2 /kernel/audit_tree.c | |
parent | ebb3b47e37a4ccef33e6388589a21a5c23d6b40b (diff) |
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>
Diffstat (limited to 'kernel/audit_tree.c')
-rw-r--r-- | kernel/audit_tree.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 3cc5b92de765..da7f7a3e6a42 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -154,7 +154,8 @@ static struct audit_chunk *alloc_chunk(int count) | |||
154 | INIT_LIST_HEAD(&chunk->owners[i].list); | 154 | INIT_LIST_HEAD(&chunk->owners[i].list); |
155 | chunk->owners[i].index = i; | 155 | chunk->owners[i].index = i; |
156 | } | 156 | } |
157 | fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); | 157 | fsnotify_init_mark(&chunk->mark, audit_tree_group, |
158 | audit_tree_destroy_watch); | ||
158 | chunk->mark.mask = FS_IN_IGNORED; | 159 | chunk->mark.mask = FS_IN_IGNORED; |
159 | return chunk; | 160 | return chunk; |
160 | } | 161 | } |
@@ -262,7 +263,7 @@ static void untag_chunk(struct node *p) | |||
262 | spin_unlock(&entry->lock); | 263 | spin_unlock(&entry->lock); |
263 | mutex_unlock(&entry->group->mark_mutex); | 264 | mutex_unlock(&entry->group->mark_mutex); |
264 | if (new) | 265 | if (new) |
265 | free_chunk(new); | 266 | fsnotify_put_mark(&new->mark); |
266 | goto out; | 267 | goto out; |
267 | } | 268 | } |
268 | 269 | ||
@@ -286,8 +287,8 @@ static void untag_chunk(struct node *p) | |||
286 | if (!new) | 287 | if (!new) |
287 | goto Fallback; | 288 | goto Fallback; |
288 | 289 | ||
289 | if (fsnotify_add_mark_locked(&new->mark, entry->group, | 290 | if (fsnotify_add_mark_locked(&new->mark, entry->connector->inode, |
290 | entry->connector->inode, NULL, 1)) { | 291 | NULL, 1)) { |
291 | fsnotify_put_mark(&new->mark); | 292 | fsnotify_put_mark(&new->mark); |
292 | goto Fallback; | 293 | goto Fallback; |
293 | } | 294 | } |
@@ -352,7 +353,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree) | |||
352 | return -ENOMEM; | 353 | return -ENOMEM; |
353 | 354 | ||
354 | entry = &chunk->mark; | 355 | entry = &chunk->mark; |
355 | if (fsnotify_add_mark(entry, audit_tree_group, inode, NULL, 0)) { | 356 | if (fsnotify_add_mark(entry, inode, NULL, 0)) { |
356 | fsnotify_put_mark(entry); | 357 | fsnotify_put_mark(entry); |
357 | return -ENOSPC; | 358 | return -ENOSPC; |
358 | } | 359 | } |
@@ -428,11 +429,11 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
428 | spin_unlock(&old_entry->lock); | 429 | spin_unlock(&old_entry->lock); |
429 | mutex_unlock(&old_entry->group->mark_mutex); | 430 | mutex_unlock(&old_entry->group->mark_mutex); |
430 | fsnotify_put_mark(old_entry); | 431 | fsnotify_put_mark(old_entry); |
431 | free_chunk(chunk); | 432 | fsnotify_put_mark(&chunk->mark); |
432 | return -ENOENT; | 433 | return -ENOENT; |
433 | } | 434 | } |
434 | 435 | ||
435 | if (fsnotify_add_mark_locked(chunk_entry, old_entry->group, | 436 | if (fsnotify_add_mark_locked(chunk_entry, |
436 | old_entry->connector->inode, NULL, 1)) { | 437 | old_entry->connector->inode, NULL, 1)) { |
437 | spin_unlock(&old_entry->lock); | 438 | spin_unlock(&old_entry->lock); |
438 | mutex_unlock(&old_entry->group->mark_mutex); | 439 | mutex_unlock(&old_entry->group->mark_mutex); |