提交 d66fd908 编写于 作者: A Amy Griffis 提交者: Linus Torvalds

[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: NAmy Griffis <amy.griffis@hp.com>
Cc: John McCutchan <john@johnmccutchan.com>
Cc: Robert Love <rlove@rlove.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 66055a4e
...@@ -894,8 +894,7 @@ static int inotify_ignore(struct inotify_device *dev, s32 wd) ...@@ -894,8 +894,7 @@ static int inotify_ignore(struct inotify_device *dev, s32 wd)
mutex_lock(&dev->mutex); mutex_lock(&dev->mutex);
/* make sure that we did not race */ /* make sure that we did not race */
watch = idr_find(&dev->idr, wd); if (likely(idr_find(&dev->idr, wd) == watch))
if (likely(watch))
remove_watch(watch, dev); remove_watch(watch, dev);
mutex_unlock(&dev->mutex); mutex_unlock(&dev->mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册