Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 527ed41f authored by Will Deacon's avatar Will Deacon Committed by Greg Kroah-Hartman
Browse files

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: default avatarPeter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarSasha Levin <alexander.levin@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bcefedb8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2502,7 +2502,7 @@ struct dentry *d_alloc_parallel(struct dentry *parent,
	}

	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;