fix NULL dereference in inotify_ignore
PATCH 1/1 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 <[email protected]>
fs/inotify.c +1 -2
@@ -889,18 +889,17 @@ static int inotify_ignore(struct inotifyget_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 ; }