aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2012-01-03 18:33:19 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-12 00:25:10 -0500
commit4f418a8259eea6b2496f79c791d1e2bf1c51abd3 (patch)
tree671c9b58e881ddf25a0903525ab80d6d2b53506f
parent16938bb22f1b01d8c3bb93d28aaeb6a67d433559 (diff)
downloadaudit-4f418a8259eea6b2496f79c791d1e2bf1c51abd3.tar.gz
inotify: silence BUG when using inotify ONESHOT functionality
The inotify might destroy a mark if it was placed with the IN_ONESHOT flag. This mark is going to be found and held in place by the srcu lock. But the destroy code assumes that anything which calls it will have explicitly taken a reference. Thus this reference isn't strictly necessary from a safe operation point of view. Instead of removing the BUG(), which will hopefully help us find other cases of similar issues, We chose to take a drop a reference in this rare case where it is safe. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> CC: stable@kernel.org Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index e3cbd746f64a5e..b5513e6f738fcc 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -130,8 +130,11 @@ static int inotify_handle_event(struct fsnotify_group *group,
ret = PTR_ERR(added_event);
}
- if (inode_mark->mask & IN_ONESHOT)
+ if (inode_mark->mask & IN_ONESHOT) {
+ fsnotify_get_mark(inode_mark);
fsnotify_destroy_mark(inode_mark);
+ fsnotify_put_mark(inode_mark);
+ }
return ret;
}