From: Will Deacon Date: Mon, 19 Feb 2018 14:55:55 +0000 (+0000) Subject: fs: dcache: Use READ_ONCE when accessing i_dir_seq X-Git-Tag: v4.9.104~185 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=527ed41ff2776311bdae56c2472ee0a5cbb60605;p=platform%2Fkernel%2Flinux-amlogic.git fs: dcache: Use READ_ONCE when accessing i_dir_seq [ Upstream commit 8cc07c808c9d595e81cbe5aad419b7769eb2e5c9 ] i_dir_seq is subject to concurrent modification by a cmpxchg or store-release operation, so ensure that the relaxed access in d_alloc_parallel uses READ_ONCE. Reported-by: Peter Zijlstra Signed-off-by: Will Deacon Signed-off-by: Al Viro Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/dcache.c b/fs/dcache.c index a12516c..7a5e6f9 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2502,7 +2502,7 @@ retry: } hlist_bl_lock(b); - if (unlikely(parent->d_inode->i_dir_seq != seq)) { + if (unlikely(READ_ONCE(parent->d_inode->i_dir_seq) != seq)) { hlist_bl_unlock(b); rcu_read_unlock(); goto retry;