diff options
author | Amy Griffis <amy.griffis@hp.com> | 2006-05-21 00:00:07 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-05-21 21:59:18 +0200 |
commit | d66fd908acc8ba88541ecc570d89b0243f947c5e (patch) | |
tree | 4367428c092231981230975b37cd1fbff3ec3155 /fs | |
parent | [PATCH] fix race in inotify_release (diff) | |
download | linux-d66fd908acc8ba88541ecc570d89b0243f947c5e.tar.xz linux-d66fd908acc8ba88541ecc570d89b0243f947c5e.zip |
[PATCH] fix NULL dereference in inotify_ignore
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>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/inotify.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/inotify.c b/fs/inotify.c index 7d5725336527..732ec4bd5774 100644 --- a/fs/inotify.c +++ b/fs/inotify.c @@ -894,8 +894,7 @@ static int inotify_ignore(struct inotify_device *dev, s32 wd) 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); |