diff options
author | Jan Kara <jack@suse.cz> | 2014-02-21 19:07:54 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2014-02-25 11:17:58 +0100 |
commit | 482ef06c5e946aae360f247dc69471ec031e09d2 (patch) | |
tree | ea36241c3ff91d0ec915e6825caa2f806db938ba /fs/notify/fanotify | |
parent | 2513190a926f093dbdc301c68e6ade0bcf293f9a (diff) | |
download | linux-rpi3-482ef06c5e946aae360f247dc69471ec031e09d2.tar.gz linux-rpi3-482ef06c5e946aae360f247dc69471ec031e09d2.tar.bz2 linux-rpi3-482ef06c5e946aae360f247dc69471ec031e09d2.zip |
fanotify: Handle overflow in case of permission events
If the event queue overflows when we are handling permission event, we
will never get response from userspace. So we must avoid waiting for it.
Change fsnotify_add_notify_event() to return whether overflow has
happened so that we can detect it in fanotify_handle_event() and act
accordingly.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify')
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 205dc2163822..dc638f786d5c 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c @@ -192,10 +192,12 @@ static int fanotify_handle_event(struct fsnotify_group *group, ret = fsnotify_add_notify_event(group, fsn_event, fanotify_merge); if (ret) { - BUG_ON(mask & FAN_ALL_PERM_EVENTS); + /* Permission events shouldn't be merged */ + BUG_ON(ret == 1 && mask & FAN_ALL_PERM_EVENTS); /* Our event wasn't used in the end. Free it. */ fsnotify_destroy_event(group, fsn_event); - ret = 0; + + return 0; } #ifdef CONFIG_FANOTIFY_ACCESS_PERMISSIONS |