summaryrefslogtreecommitdiffstats
path: root/fs/notify/fanotify
diff options
context:
space:
mode:
authorAmir Goldstein2019-06-19 12:34:44 +0200
committerJan Kara2019-06-19 15:53:58 +0200
commitc285a2f01d692ef48d7243cf1072897bbd237407 (patch)
treed6959488584787c33c90c971805e48920831289f /fs/notify/fanotify
parentquota: fix a problem about transfer quota (diff)
downloadkernel-qcow2-linux-c285a2f01d692ef48d7243cf1072897bbd237407.tar.gz
kernel-qcow2-linux-c285a2f01d692ef48d7243cf1072897bbd237407.tar.xz
kernel-qcow2-linux-c285a2f01d692ef48d7243cf1072897bbd237407.zip
fanotify: update connector fsid cache on add mark
When implementing connector fsid cache, we only initialized the cache when the first mark added to object was added by FAN_REPORT_FID group. We forgot to update conn->fsid when the second mark is added by FAN_REPORT_FID group to an already attached connector without fsid cache. Reported-and-tested-by: syzbot+c277e8e2f46414645508@syzkaller.appspotmail.com Fixes: 77115225acc6 ("fanotify: cache fsid in fsnotify_mark_connector") Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/fanotify')
-rw-r--r--fs/notify/fanotify/fanotify.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index e6fde1a5c072..b428c295d13f 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -355,6 +355,10 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info)
/* Mark is just getting destroyed or created? */
if (!conn)
continue;
+ if (!(conn->flags & FSNOTIFY_CONN_FLAG_HAS_FSID))
+ continue;
+ /* Pairs with smp_wmb() in fsnotify_add_mark_list() */
+ smp_rmb();
fsid = conn->fsid;
if (WARN_ON_ONCE(!fsid.val[0] && !fsid.val[1]))
continue;