WSL2-Linux-Kernel/drivers/char
Eric Biggers b34e7e298d /dev/mem: Add missing memory barriers for devmem_inode
WRITE_ONCE() isn't the correct way to publish a pointer to a data
structure, since it doesn't include a write memory barrier.  Therefore
other tasks may see that the pointer has been set but not see that the
pointed-to memory has finished being initialized yet.  Instead a
primitive with "release" semantics is needed.

Use smp_store_release() for this.

The use of READ_ONCE() on the read side is still potentially correct if
there's no control dependency, i.e. if all memory being "published" is
transitively reachable via the pointer itself.  But this pairing is
somewhat confusing and error-prone.  So just upgrade the read side to
smp_load_acquire() so that it clearly pairs with smp_store_release().

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Fixes: 3234ac664a ("/dev/mem: Revoke mappings when a driver claims the region")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Cc: stable <stable@vger.kernel.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/20200716060553.24618-1-ebiggers@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-23 09:47:13 +02:00
..
agp treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
hw_random hwrng: ks-sa - Fix runtime PM imbalance on error 2020-06-15 17:38:53 +10:00
ipmi IPMI update for 5.8 2020-06-05 13:58:04 -07:00
mwave
pcmcia
tpm Revert commit e918e57041 ("tpm_tis: Remove the HID IFX0102") 2020-07-07 04:25:17 +03:00
xilinx_hwicap
xillybus
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile
adi.c
apm-emulation.c
applicom.c
applicom.h
bsr.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
ds1620.c
dsp56k.c
dtlk.c
hangcheck-timer.c
hpet.c
lp.c
mem.c /dev/mem: Add missing memory barriers for devmem_inode 2020-07-23 09:47:13 +02:00
misc.c
mspec.c mmap locking API: convert mmap_sem comments 2020-06-09 09:39:14 -07:00
nsc_gpio.c
nvram.c
nwbutton.c
nwbutton.h
nwflash.c
pc8736x_gpio.c
powernv-op-panel.c
ppdev.c
ps3flash.c
random.c Merge branch 'work.sysctl' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-06-10 16:05:54 -07:00
raw.c
scx200_gpio.c
sonypi.c
tb0219.c
tlclk.c
toshiba.c
ttyprintk.c
uv_mmtimer.c
virtio_console.c virtio: virtio_console: add missing MODULE_DEVICE_TABLE() for rproc serial 2020-07-10 15:12:48 +02:00