summaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
authorLino Sanfilippo <LinoSanfilippo@gmx.de>2013-07-08 15:59:45 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 10:33:20 -0700
commite1e5a9f84e4dbd3567bb8b0d5e79db6e1e5ebc35 (patch)
treedb9188f5d2ed4f35eb67ccffa25bff598b2593bc /fs/notify/mark.c
parent52f85729805b7a0ec5a7a70e2c814193929de2f0 (diff)
downloadop-kernel-dev-e1e5a9f84e4dbd3567bb8b0d5e79db6e1e5ebc35.zip
op-kernel-dev-e1e5a9f84e4dbd3567bb8b0d5e79db6e1e5ebc35.tar.gz
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>
Diffstat (limited to 'fs/notify/mark.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud