[PATCH] fix race in inotify_release
authorAmy Griffis <amy.griffis@hp.com>
Sat, 20 May 2006 22:00:06 +0000 (15:00 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 21 May 2006 19:59:18 +0000 (12:59 -0700)
commit66055a4e7334b05354c835123ff621c5f700e56a
treede9d4b432e48d4c919b70a627d9ba0b50e840de0
parent12783b002db1f02c29353c8f698a85514420b9f4
[PATCH] fix race in inotify_release

While doing some inotify stress testing, I hit the following race.  In
inotify_release(), it's possible for a watch to be removed from the lists
in between dropping dev->mutex and taking inode->inotify_mutex.  The
reference we hold prevents the watch from being freed, but not from being
removed.

Checking the dev's idr mapping will prevent a double list_del of the
same watch.

Signed-off-by: Amy Griffis <amy.griffis@hp.com>
Acked-by: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rml@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/inotify.c