summaryrefslogtreecommitdiffstats
path: root/fs/notify/group.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2014-02-21 19:14:11 +0100
committerJan Kara <jack@suse.cz>2014-02-25 11:18:06 +0100
commitff57cd5863cf3014c1c5ed62ce2715294f065b17 (patch)
treec9bc7bd04326afc92d85a476d28453218c40e14e /fs/notify/group.c
parentfanotify: Handle overflow in case of permission events (diff)
downloadlinux-ff57cd5863cf3014c1c5ed62ce2715294f065b17.tar.xz
linux-ff57cd5863cf3014c1c5ed62ce2715294f065b17.zip
fsnotify: Allocate overflow events with proper type
Commit 7053aee26a35 "fsnotify: do not share events between notification groups" used overflow event statically allocated in a group with the size of the generic notification event. This causes problems because some code looks at type specific parts of event structure and gets confused by a random data it sees there and causes crashes. Fix the problem by allocating overflow event with type corresponding to the group type so code cannot get confused. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/group.c')
-rw-r--r--fs/notify/group.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/notify/group.c b/fs/notify/group.c
index ee674fe2cec7..ad1995980456 100644
--- a/fs/notify/group.c
+++ b/fs/notify/group.c
@@ -55,6 +55,13 @@ void fsnotify_destroy_group(struct fsnotify_group *group)
/* clear the notification queue of all events */
fsnotify_flush_notify(group);
+ /*
+ * Destroy overflow event (we cannot use fsnotify_destroy_event() as
+ * that deliberately ignores overflow events.
+ */
+ if (group->overflow_event)
+ group->ops->free_event(group->overflow_event);
+
fsnotify_put_group(group);
}
@@ -99,7 +106,6 @@ struct fsnotify_group *fsnotify_alloc_group(const struct fsnotify_ops *ops)
INIT_LIST_HEAD(&group->marks_list);
group->ops = ops;
- fsnotify_init_event(&group->overflow_event, NULL, FS_Q_OVERFLOW);
return group;
}