alistair23-linux/fs/notify
Lino Sanfilippo e1e5a9f84e inotify: fix race when adding a new watch
In inotify_new_watch() the number of watches for a group is compared
against the max number of allowed watches and increased afterwards.  The
check and incrementation is not done atomically, so it is possible for
multiple concurrent threads to pass the check and increment the number
of marks above the allowed max.

This patch uses an inotify groups mark_lock to ensure that both check
and incrementation are done atomic.  Furthermore we dont have to worry
about the race that allows a concurrent thread to add a watch just after
inotify_update_existing_watch() returned with -ENOENT anymore, since
this is also synchronized by the groups mark mutex now.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Cc: Eric Paris <eparis@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-09 10:33:20 -07:00
..
dnotify dnotify: replace dnotify_mark_mutex with mark mutex of dnotify_group 2013-07-09 10:33:20 -07:00
fanotify fanotify: put duplicate code for adding vfsmount/inode marks into an own function 2013-07-09 10:33:20 -07:00
inotify inotify: fix race when adding a new watch 2013-07-09 10:33:20 -07:00
fdinfo.c Merge branch 'for-next' of git://git.infradead.org/users/eparis/notify 2012-12-20 20:11:52 -08:00
fdinfo.h fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
fsnotify.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
fsnotify.h
group.c fsnotify: make fasync generic for both inotify and fanotify 2012-12-11 13:44:36 -05:00
inode_mark.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
Kconfig
Makefile fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
mark.c fsnotify: change locking order 2012-12-11 13:44:36 -05:00
notification.c Merge branch 'for-next' of git://git.infradead.org/users/eparis/notify 2012-12-20 20:11:52 -08:00
vfsmount_mark.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00