sst-linux/include
Oleg Nesterov 3375bdf84c poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll()
[ Upstream commit cacd9ae4bf801ff4125d8961bb9a3ba955e51680 ]

As the comment above waitqueue_active() explains, it can only be used
if both waker and waiter have mb()'s that pair with each other. However
__pollwait() is broken in this respect.

This is not pipe-specific, but let's look at pipe_poll() for example:

	poll_wait(...); // -> __pollwait() -> add_wait_queue()

	LOAD(pipe->head);
	LOAD(pipe->head);

In theory these LOAD()'s can leak into the critical section inside
add_wait_queue() and can happen before list_add(entry, wq_head), in this
case pipe_poll() can race with wakeup_pipe_readers/writers which do

	smp_mb();
	if (waitqueue_active(wq_head))
		wake_up_interruptible(wq_head);

There are more __pollwait()-like functions (grep init_poll_funcptr), and
it seems that at least ep_ptable_queue_proc() has the same problem, so the
patch adds smp_mb() into poll_wait().

Link: https://lore.kernel.org/all/20250102163320.GA17691@redhat.com/
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Link: https://lore.kernel.org/r/20250107162717.GA18922@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-01-23 17:17:12 +01:00
..
acpi ACPI: CPPC: Make rmw_lock a raw_spin_lock 2024-11-08 16:26:43 +01:00
asm-generic vmlinux.lds.h: catch .bss..L* sections into BSS") 2024-08-03 08:49:02 +02:00
clocksource x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-09 13:29:56 +01:00
crypto crypto: simd - Do not call crypto_alloc_tfm during registration 2024-10-17 15:21:39 +02:00
drm drm/ttm: Make sure the mapped tt pages are decrypted when needed 2024-12-14 19:54:54 +01:00
dt-bindings dt-bindings: clock: qcom: Add GPLL9 support on gcc-sc8180x 2024-10-17 15:22:07 +02:00
keys
kunit
kvm KVM: arm64: Fix host-programmed guest events in nVHE 2024-04-10 16:28:23 +02:00
linux poll_wait: add mb() to fix theoretical race between waitqueue_active() and .poll() 2025-01-23 17:17:12 +01:00
math-emu
media media: v4l2-core: v4l2-dv-timings: check cvt/gtf result 2024-12-14 19:54:04 +01:00
memory memory: renesas-rpc-if: Remove Runtime PM wrappers 2024-12-14 19:53:37 +01:00
misc
net net: add exit_batch_rtnl() method 2025-01-23 17:17:09 +01:00
pcmcia
ras
rdma
rv
scsi scsi: core: Fix the return value of scsi_logical_block_count() 2024-08-29 17:30:49 +02:00
soc net: mscc: ocelot: be resilient to loss of PTP packets during transmission 2024-12-19 18:08:54 +01:00
sound ALSA: dmaengine: Synchronize dma channel after drop() 2024-07-25 09:49:14 +02:00
target
trace tracing/ftrace: disable preemption in syscall probe 2024-12-14 19:54:45 +01:00
uapi stddef: make __struct_group() UAPI C++-friendly 2025-01-02 10:30:51 +01:00
ufs scsi: ufs: core: Make DMA mask configuration more flexible 2024-12-14 19:54:46 +01:00
vdso
video
xen