android_kernel_motorola_sm6375/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Mikulas Patocka d14b6fe911 add barriers to buffer_uptodate and set_buffer_uptodate
commit d4252071b97d2027d246f6a82cbee4d52f618b47 upstream.

Let's have a look at this piece of code in __bread_slow:

	get_bh(bh);
	bh->b_end_io = end_buffer_read_sync;
	submit_bh(REQ_OP_READ, 0, bh);
	wait_on_buffer(bh);
	if (buffer_uptodate(bh))
		return bh;

Neither wait_on_buffer nor buffer_uptodate contain any memory barrier.
Consequently, if someone calls sb_bread and then reads the buffer data,
the read of buffer data may be executed before wait_on_buffer(bh) on
architectures with weak memory ordering and it may return invalid data.

Fix this bug by adding a memory barrier to set_buffer_uptodate and an
acquire barrier to buffer_uptodate (in a similar way as
folio_test_uptodate and folio_mark_uptodate).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: stable@vger.kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-08-25 11:17:18 +02:00
..
acpi
asm-generic tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry 2022-04-20 09:19:37 +02:00
clocksource
crypto crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-06-22 14:11:18 +02:00
drm drm: fix EDID struct for old ARM OABI format 2022-06-14 18:11:31 +02:00
dt-bindings
keys
kvm
linux add barriers to buffer_uptodate and set_buffer_uptodate 2022-08-25 11:17:18 +02:00
math-emu
media
misc
net ipv6/addrconf: fix a null-ptr-deref bug for ip6_ptr 2022-08-03 11:59:39 +02:00
pcmcia
ras
rdma
scsi scsi: fcoe: Fix Wstringop-overflow warnings in fcoe_wwn_from_mac() 2022-06-14 18:11:40 +02:00
soc
sound ALSA: jack: Access input_dev under mutex 2022-06-14 18:11:25 +02:00
target
trace net: sock: tracing: Fix sock_exceed_buf_limit not to dereference stale pointer 2022-07-21 20:59:16 +02:00
uapi random: ignore GRND_RANDOM in getentropy(2) 2022-06-22 14:11:03 +02:00
vdso
video video: of_display_timing.h: include errno.h 2022-07-12 16:30:47 +02:00
xen