mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
[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>
This commit is contained in:
parent
66055a4e73
commit
d66fd908ac
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user