linux-stable/fs/notify
Amir Goldstein 71f24a9130 fanotify: fix logic of events on child
commit 54a307ba8d upstream.

When event on child inodes are sent to the parent inode mark and
parent inode mark was not marked with FAN_EVENT_ON_CHILD, the event
will not be delivered to the listener process. However, if the same
process also has a mount mark, the event to the parent inode will be
delivered regadless of the mount mark mask.

This behavior is incorrect in the case where the mount mark mask does
not contain the specific event type. For example, the process adds
a mark on a directory with mask FAN_MODIFY (without FAN_EVENT_ON_CHILD)
and a mount mark with mask FAN_CLOSE_NOWRITE (without FAN_ONDIR).

A modify event on a file inside that directory (and inside that mount)
should not create a FAN_MODIFY event, because neither of the marks
requested to get that event on the file.

Fixes: 1968f5eed5 ("fanotify: use both marks when possible")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
[natechancellor: Fix small conflict due to lack of 3cd5eca8d7]
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-24 09:34:18 +02:00
..
dnotify fsnotify: get rid of fsnotify_destroy_mark_locked() 2015-09-04 16:54:41 -07:00
fanotify fanotify: fix logic of events on child 2018-04-24 09:34:18 +02:00
inotify fsnotify: convert notification_mutex to a spinlock 2016-10-07 18:46:26 -07:00
fdinfo.c inotify: hide internal kernel bits from fdinfo 2015-11-05 19:34:48 -08:00
fdinfo.h fs: Convert show_fdinfo functions to void 2014-11-05 14:13:23 -05:00
fsnotify.c dentry name snapshots 2017-08-06 18:59:43 -07:00
fsnotify.h fsnotify: avoid spurious EMFILE errors from inotify_init() 2016-05-19 19:12:14 -07:00
group.c fsnotify: convert notification_mutex to a spinlock 2016-10-07 18:46:26 -07:00
inode_mark.c fsnotify: Fix possible use-after-free in inode iteration on umount 2017-01-09 08:32:22 +01:00
Kconfig rcu: Make SRCU optional by using CONFIG_SRCU 2015-01-06 11:04:29 -08:00
Makefile fs, notify: add procfs fdinfo helper 2012-12-17 17:15:28 -08:00
mark.c fsnotify: avoid spurious EMFILE errors from inotify_init() 2016-05-19 19:12:14 -07:00
notification.c fsnotify: clean up spinlock assertions 2016-10-07 18:46:26 -07:00
vfsmount_mark.c fsnotify: remove mark->free_list 2015-09-04 16:54:41 -07:00