deepin-kernel/include
David Howells 9a8aba1680 rxrpc: Fix recv-recv race of completed call
[ Upstream commit 962fb1f651c2cf2083e0c3ef53ba69e3b96d3fbc ]

If a call receives an event (such as incoming data), the call gets placed
on the socket's queue and a thread in recvmsg can be awakened to go and
process it.  Once the thread has picked up the call off of the queue,
further events will cause it to be requeued, and once the socket lock is
dropped (recvmsg uses call->user_mutex to allow the socket to be used in
parallel), a second thread can come in and its recvmsg can pop the call off
the socket queue again.

In such a case, the first thread will be receiving stuff from the call and
the second thread will be blocked on call->user_mutex.  The first thread
can, at this point, process both the event that it picked call for and the
event that the second thread picked the call for and may see the call
terminate - in which case the call will be "released", decoupling the call
from the user call ID assigned to it (RXRPC_USER_CALL_ID in the control
message).

The first thread will return okay, but then the second thread will wake up
holding the user_mutex and, if it sees that the call has been released by
the first thread, it will BUG thusly:

	kernel BUG at net/rxrpc/recvmsg.c:474!

Fix this by just dequeuing the call and ignoring it if it is seen to be
already released.  We can't tell userspace about it anyway as the user call
ID has become stale.

Fixes: 248f219cb8 ("rxrpc: Rewrite the data and ack handling code")
Reported-by: Junvyyang, Tencent Zhuque Lab <zhuque@tencent.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeffrey Altman <jaltman@auristor.com>
cc: LePremierHomme <kwqcheii@proton.me>
cc: Marc Dionne <marc.dionne@auristor.com>
cc: Simon Horman <horms@kernel.org>
cc: linux-afs@lists.infradead.org
Link: https://patch.msgid.link/20250717074350.3767366-3-dhowells@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 7692bde890061797f3dece0148d7859e85c55778)
2025-07-28 15:19:07 +08:00
..
acpi ACPICA: Avoid sequence overread in call to strncmp() 2025-07-03 11:31:59 +08:00
asm-generic kbuild: Add Propeller configuration for kernel build 2025-05-29 20:38:29 +08:00
clocksource x86/hyperv: Fix hv tsc page based sched_clock for hibernation 2025-01-13 11:06:44 +08:00
crypto crypto: ahash - Set default reqsize from ahash_alg 2025-06-10 10:35:01 +08:00
drm drm/framebuffer: Acquire internal references on GEM handles 2025-07-22 16:16:42 +08:00
dt-bindings pinctrl: add pinctrl dirver for UltraRisc DP1000 2025-06-19 11:22:03 +08:00
keys
kunit
kvm KVM: arm64: Fix host-programmed guest events in nVHE 2024-04-10 16:35:48 +02:00
linux arch: add ARCH_HAS_KERNEL_FPU_SUPPORT 2025-07-24 23:36:39 +08:00
math-emu
media media: v4l: Memset argument to 0 before calling get_mbus_config pad op 2025-06-10 16:17:55 +08:00
memory
misc
net netfilter: nf_conntrack: fix crash due to removal of uninitialised entry 2025-07-28 15:19:06 +08:00
pcmcia
ras
rdma RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject() 2025-06-10 10:34:55 +08:00
rv rv: Reset per-task monitors also for idle tasks 2025-02-18 11:53:09 +08:00
scsi deepin: KABI: KABI reservation for libsas.h 2025-02-11 20:32:07 +08:00
soc crypto: loongson: add loongson crypto driver 2025-06-13 14:02:00 +08:00
sound ALSA: pcm: Fix race of buffer access at PCM OSS layer 2025-06-10 16:18:03 +08:00
target
trace rxrpc: Fix recv-recv race of completed call 2025-07-28 15:19:07 +08:00
uapi tcp: Dump bound-only sockets in inet_diag. 2025-07-14 14:11:44 +08:00
ufs scsi: ufs: core: Add OPP support for scaling clocks and regulators 2025-07-14 10:42:15 +08:00
vdso
video
xen xen/mcelog: Add __nonstring annotations for unterminated strings 2025-05-09 18:47:16 +08:00