From: Amy Griffis Date: Sat, 20 May 2006 22:00:07 +0000 (-0700) Subject: [PATCH] fix NULL dereference in inotify_ignore X-Git-Tag: v2.6.17-rc5~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d66fd908acc8ba88541ecc570d89b0243f947c5e;p=platform%2Fkernel%2Flinux-3.10.git [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 Cc: John McCutchan Cc: Robert Love Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/inotify.c b/fs/inotify.c index 7d57253..732ec4b 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);