mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 21:21:41 +00:00
8238b45798
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>
21 lines
701 B
C
21 lines
701 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
|
#define _ASM_GENERIC_BITOPS_NON_ATOMIC_H_
|
|
|
|
#include <asm-generic/bitops/generic-non-atomic.h>
|
|
|
|
#define arch___set_bit generic___set_bit
|
|
#define arch___clear_bit generic___clear_bit
|
|
#define arch___change_bit generic___change_bit
|
|
|
|
#define arch___test_and_set_bit generic___test_and_set_bit
|
|
#define arch___test_and_clear_bit generic___test_and_clear_bit
|
|
#define arch___test_and_change_bit generic___test_and_change_bit
|
|
|
|
#define arch_test_bit generic_test_bit
|
|
#define arch_test_bit_acquire generic_test_bit_acquire
|
|
|
|
#include <asm-generic/bitops/non-instrumented-non-atomic.h>
|
|
|
|
#endif /* _ASM_GENERIC_BITOPS_NON_ATOMIC_H_ */
|