Revision 8238b4579866b7c1bb99883cfe102a43db5506ff authored by Mikulas Patocka on 26 August 2022, 13:17:08 UTC, committed by Linus Torvalds on 26 August 2022, 16:30:25 UTC
There are several places in the kernel where wait_on_bit is not followed
by a memory barrier (for example, in drivers/md/dm-bufio.c:new_read).

On architectures with weak memory ordering, it may happen that memory
accesses that follow wait_on_bit are reordered before wait_on_bit and
they may return invalid data.

Fix this class of bugs by introducing a new function "test_bit_acquire"
that works like test_bit, but has acquire memory ordering semantics.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4c61282
Raw File
.cocciconfig
[spatch]
	options = --timeout 200
	options = --use-gitgrep
back to top