]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
fs: dcache: Use READ_ONCE when accessing i_dir_seq
authorWill Deacon <will.deacon@arm.com>
Mon, 19 Feb 2018 14:55:55 +0000 (14:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:50:30 +0000 (07:50 +0200)
[ 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 <peterz@infradead.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/dcache.c

index a12516c5d2f09a332fda5f63ff82c1f01bed3685..7a5e6f9717f510471fb95c9440e6fee08e4ff626 100644 (file)
@@ -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;