linux-yocto/include
David Howells 839fe96c15 rxrpc: Fix recv-recv race of completed call
[ Upstream commit 962fb1f651 ]

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>
2025-07-24 08:56:35 +02:00
..
acpi ACPICA: Avoid sequence overread in call to strncmp() 2025-06-27 11:11:26 +01:00
asm-generic mm: hugetlb: Add huge page size param to huge_ptep_get_and_clear() 2025-03-13 13:02:17 +01:00
clocksource
crypto crypto: ahash - Set default reqsize from ahash_alg 2025-05-29 11:02:40 +02:00
cxl
drm drm/framebuffer: Acquire internal references on GEM handles 2025-07-17 18:37:12 +02:00
dt-bindings dt-bindings: clock: sunxi: Export PLL_VIDEO_2X and PLL_MIPI 2025-02-08 09:57:09 +01:00
keys
kunit kunit: platform: Resolve 'struct completion' warning 2025-02-21 14:01:25 +01:00
kvm
linux crypto: ecdsa - Harden against integer overflows in DIV_ROUND_UP() 2025-07-17 18:37:24 +02:00
math-emu
media media: v4l: Memset argument to 0 before calling get_mbus_config pad op 2025-05-29 11:02:49 +02:00
memory
misc
net netfilter: nf_conntrack: fix crash due to removal of uninitialised entry 2025-07-24 08:56:33 +02:00
pcmcia
ras
rdma RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject() 2025-05-29 11:02:19 +02:00
rv rv: Reset per-task monitors also for idle tasks 2025-02-17 10:05:30 +01:00
scsi
soc soc: qcom: ice: introduce devm_of_qcom_ice_get 2025-05-02 07:58:52 +02:00
sound ASoC: soc-acpi: add get_function_tplg_files ops 2025-07-17 18:37:02 +02:00
target
trace rxrpc: Fix recv-recv race of completed call 2025-07-24 08:56:35 +02:00
uapi vsock/uapi: fix linux/vm_sockets.h userspace compilation errors 2025-07-06 11:01:40 +02:00
ufs scsi: ufs: Introduce quirk to extend PA_HIBERN8TIME for UFS devices 2025-05-29 11:01:58 +02:00
vdso
video
xen xen/mcelog: Add __nonstring annotations for unterminated strings 2025-04-20 10:15:12 +02:00