From: Sasha Levin Date: Tue, 6 Nov 2018 17:34:25 +0000 (-0500) Subject: queue fsnotify-fix-ignore-mask-logic-in-fsnotify.patch for 4.14 X-Git-Tag: v3.18.125~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f95f44fb055e34c96ff6ad1d9fdb7f1cb180da6;p=thirdparty%2Fkernel%2Fstable-queue.git queue fsnotify-fix-ignore-mask-logic-in-fsnotify.patch for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/fsnotify-fix-ignore-mask-logic-in-fsnotify.patch b/queue-4.14/fsnotify-fix-ignore-mask-logic-in-fsnotify.patch new file mode 100644 index 00000000000..53966a5c4f7 --- /dev/null +++ b/queue-4.14/fsnotify-fix-ignore-mask-logic-in-fsnotify.patch @@ -0,0 +1,62 @@ +From e1b4bdb78692dc0f09859dc114fbedc66f24c486 Mon Sep 17 00:00:00 2001 +From: Amir Goldstein +Date: Sat, 1 Sep 2018 09:40:01 +0300 +Subject: fsnotify: fix ignore mask logic in fsnotify() + +[ Upstream commit 9bdda4e9cf2dcecb60a0683b10ffb8cd7e5f2f45 ] + +Commit 92183a42898d ("fsnotify: fix ignore mask logic in +send_to_group()") acknoledges the use case of ignoring an event on +an inode mark, because of an ignore mask on a mount mark of the same +group (i.e. I want to get all events on this file, except for the events +that came from that mount). + +This change depends on correctly merging the inode marks and mount marks +group lists, so that the mount mark ignore mask would be tested in +send_to_group(). Alas, the merging of the lists did not take into +account the case where event in question is not in the mask of any of +the mount marks. + +To fix this, completely remove the tests for inode and mount event masks +from the lists merging code. + +Fixes: 92183a42898d ("fsnotify: fix ignore mask logic in send_to_group") +Signed-off-by: Amir Goldstein +Signed-off-by: Jan Kara +[amir: backport to v4.14.y] +Signed-off-by: Amir Goldstein +Signed-off-by: Sasha Levin +--- + fs/notify/fsnotify.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c +index d76c81323dc1..2bc61e7543dd 100644 +--- a/fs/notify/fsnotify.c ++++ b/fs/notify/fsnotify.c +@@ -286,17 +286,13 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, + + iter_info.srcu_idx = srcu_read_lock(&fsnotify_mark_srcu); + +- if ((mask & FS_MODIFY) || +- (test_mask & to_tell->i_fsnotify_mask)) { +- inode_conn = srcu_dereference(to_tell->i_fsnotify_marks, ++ inode_conn = srcu_dereference(to_tell->i_fsnotify_marks, ++ &fsnotify_mark_srcu); ++ if (inode_conn) ++ inode_node = srcu_dereference(inode_conn->list.first, + &fsnotify_mark_srcu); +- if (inode_conn) +- inode_node = srcu_dereference(inode_conn->list.first, +- &fsnotify_mark_srcu); +- } + +- if (mnt && ((mask & FS_MODIFY) || +- (test_mask & mnt->mnt_fsnotify_mask))) { ++ if (mnt) { + inode_conn = srcu_dereference(to_tell->i_fsnotify_marks, + &fsnotify_mark_srcu); + if (inode_conn) +-- +2.17.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 6efac4eb8e9..be22bb8015e 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -5,3 +5,4 @@ usb-serial-option-add-two-endpoints-device-id-flag.patch bpf-fix-partial-copy-of-map_ptr-when-dst-is-scalar.patch revert-arm-tegra-fix-ulpi-regression-on-tegra20.patch clk-tegra-add-quirk-for-getting-cdev1-2-clocks-on-te.patch +fsnotify-fix-ignore-mask-logic-in-fsnotify.patch