* [PATCH] fix NULL dereference in inotify_ignore
@ 2006-05-20 4:45 Amy Griffis
0 siblings, 0 replies; only message in thread
From: Amy Griffis @ 2006-05-20 4:45 UTC (permalink / raw)
To: linux-kernel; +Cc: John McCutchan, Robert Love
Don't reassign to watch. If idr_find() returns NULL, then
put_inotify_watch will choke.
Signed-off-by: Amy Griffis <amy.griffis@hp.com>
diff --git a/fs/inotify.c b/fs/inotify.c
index 7d57253..5d4ba7c 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -889,18 +889,17 @@ static int inotify_ignore(struct inotify
get_inotify_watch(watch);
inode = watch->inode;
mutex_unlock(&dev->mutex);
mutex_lock(&inode->inotify_mutex);
mutex_lock(&dev->mutex);
/* make sure that we did not race */
- watch = idr_find(&dev->idr, wd);
- if (likely(watch))
+ if (likely(idr_find(&dev->idr, wd) == watch))
remove_watch(watch, dev);
mutex_unlock(&dev->mutex);
mutex_unlock(&inode->inotify_mutex);
put_inotify_watch(watch);
return 0;
}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2006-05-20 4:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-20 4:45 [PATCH] fix NULL dereference in inotify_ignore Amy Griffis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox