linux/fs/notify/fanotify
Miklos Szeredi 1dd7dd07e8 fanotify: fix fsnotify_prepare_user_wait() failure
commit f37650f1c7 upstream.

If fsnotify_prepare_user_wait() fails, we leave the event on the
notification list.  Which will result in a warning in
fsnotify_destroy_event() and later use-after-free.

Instead of adding a new helper to remove the event from the list in this
case, I opted to move the prepare/finish up into fanotify_handle_event().

This will allow these to be moved further out into the generic code later,
and perhaps let us move to non-sleeping RCU.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 05f0e38724 ("fanotify: Release SRCU lock when waiting for userspace response")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2017-11-30 08:40:45 +00:00
..
fanotify.c fanotify: fix fsnotify_prepare_user_wait() failure 2017-11-30 08:40:45 +00:00
fanotify.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
fanotify_user.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig treewide: fix typo of "suport" in various comments and Kconfig 2012-11-19 14:16:09 +01:00
Makefile fanotify: fanotify_init syscall declaration 2010-07-28 09:58:55 -04:00