linux/fs/notify
Jan Kara 138a11159e fsnotify: fix oops in fsnotify_clear_marks_by_group_flags()
commit 8f2f3eb59d upstream.

fsnotify_clear_marks_by_group_flags() can race with
fsnotify_destroy_marks() so that when fsnotify_destroy_mark_locked()
drops mark_mutex, a mark from the list iterated by
fsnotify_clear_marks_by_group_flags() can be freed and thus the next
entry pointer we have cached may become stale and we dereference free
memory.

Fix the problem by first moving marks to free to a special private list
and then always free the first entry in the special list.  This method
is safe even when entries from the list can disappear once we drop the
lock.

Signed-off-by: Jan Kara <jack@suse.com>
Reported-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Ashish Sangwan <a.sangwan@samsung.com>
Cc: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-08-27 12:08:16 +01:00
..
dnotify inotify: Fix reporting of cookies for inotify events 2014-02-18 11:17:17 +01:00
fanotify fanotify: enable close-on-exec on events' fd when requested in fanotify_init() 2014-10-30 09:40:16 -07:00
inotify inotify: convert use of typedef ctl_table to struct ctl_table 2014-06-06 16:08:16 -07:00
fdinfo.c fs/notify: don't show f_handle if exportfs_encode_inode_fh failed 2014-10-05 13:41:07 -07:00
fdinfo.h fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
fsnotify.c move d_rcu from overlapping d_child to overlapping d_alias 2015-01-15 10:44:58 +00:00
fsnotify.h fsnotify: remove global fsnotify groups lists 2010-07-28 10:18:54 -04:00
group.c fsnotify: Allocate overflow events with proper type 2014-02-25 11:18:06 +01:00
inode_mark.c fsnotify: next_i is freed during fsnotify_unmount_inodes. 2015-01-16 14:34:38 +00:00
Kconfig fanotify: allow fanotify to be built 2010-10-28 17:22:13 -04:00
Makefile fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
mark.c fsnotify: fix oops in fsnotify_clear_marks_by_group_flags() 2015-08-27 12:08:16 +01:00
notification.c fanotify: fix double free of pending permission events 2014-09-17 09:21:53 -07:00
vfsmount_mark.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00