fsnotify: pin both inode and vfsmount mark
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 30 Oct 2017 20:14:55 +0000 (21:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:47 +0000 (08:40 +0000)
commit9e9569f05ea699e2453f25fed562b3cb969b8aef
tree4c9cb2d60ae9763f5e0e8d2009715b92a570717b
parent47b02dcac666c310705621187557a84f0176d0f9
fsnotify: pin both inode and vfsmount mark

commit 0d6ec079d6aaa098b978d6395973bb027c752a03 upstream.

We may fail to pin one of the marks in fsnotify_prepare_user_wait() when
dropping the srcu read lock, resulting in use after free at the next
iteration.

Solution is to store both marks in iter_info instead of just the one we'll
be sending the event for.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: 9385a84d7e1f ("fsnotify: Pass fsnotify_iter_info into handle_event handler")
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/notify/fsnotify.c