Commit a3e4c8f8 authored by linke li's avatar linke li Committed by Greg Kroah-Hartman
Browse files

sbitmap: use READ_ONCE to access map->word



[ Upstream commit 6ad0d7e0 ]

In __sbitmap_queue_get_batch(), map->word is read several times, and
update atomically using atomic_long_try_cmpxchg(). But the first two read
of map->word is not protected.

This patch moves the statement val = READ_ONCE(map->word) forward,
eliminating unprotected accesses to map->word within the function.
It is aimed at reducing the number of benign races reported by KCSAN in
order to focus future debugging effort on harmful races.

Signed-off-by: default avatarlinke li <lilinke99@qq.com>
Link: https://lore.kernel.org/r/tencent_0B517C25E519D3D002194E8445E86C04AD0A@qq.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Stable-dep-of: 72d04bdc ("sbitmap: fix io hung due to race on sbitmap_word::cleared")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent e511167e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment