linux/net/sctp
Jun Yang 4f1da630d1 sctp: check RCV_SHUTDOWN after the sendmsg connect wait
sctp_wait_for_connect() drops the socket lock while it sleeps. An
out-of-the-blue ABORT can then be processed from the socket backlog and
unlink the association. If a concurrent shutdown(fd, SHUT_RD) sets
RCV_SHUTDOWN, the waiter breaks with err == 0 before checking
asoc->base.dead. Its final sctp_association_put() can then free the
association, leaving sctp_sendmsg_to_asoc() to continue with a dangling
pointer.

Check RCV_SHUTDOWN along with the wait error in sctp_sendmsg_to_asoc()
before using the association again. The check only accesses the socket,
so it needs no additional association reference. Return the existing
-ESRCH so that sctp_sendmsg() skips freeing a new association that may
already have been destroyed.

Keep sctp_wait_for_connect() unchanged to preserve its behavior for the
connect() caller.

Fixes: 668c9beb90 ("sctp: implement assign_number for sctp_stream_interleave")
Cc: stable@vger.kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Signed-off-by: Jun Yang <junvyyang@tencent.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/20260926095606.68601-1-juny24602@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-09-30 16:55:47 -07:00
..
associola.c sctp: avoid livelock while updating retransmit path 2026-09-18 17:24:10 -07:00
auth.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-08-13 11:00:14 -07:00
bind_addr.c sctp: validate embedded INIT chunk and address list lengths in cookie 2026-06-09 18:16:51 -07:00
chunk.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
debug.c
diag.c sctp: hold socket lock when dumping endpoints in sctp_diag 2026-06-17 16:41:34 -07:00
endpointola.c sctp: auth: discard auth_chunk when skb_clone fails 2026-07-29 16:36:20 -07:00
input.c sctp: hold asoc or transport before mod_timer() in timer handlers 2026-09-22 18:36:36 -07:00
inqueue.c sctp: validate chunk length in the inqueue parser 2026-08-30 14:17:53 -07:00
ipv6.c sctp: Unwind address notifier registration on failure 2026-06-10 08:28:40 -07:00
Kconfig ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs 2026-03-29 11:21:22 -07:00
Makefile
objcnt.c
offload.c sctp: use skb_crc32c() instead of __skb_checksum() 2025-05-21 15:40:16 -07:00
output.c sctp: auth: propagate HMAC calculation errors to callers 2026-08-11 10:43:54 +02:00
outqueue.c sctp: keep chunk->transport in step with the list it is queued on 2026-08-03 14:23:05 -07:00
primitive.c
proc.c net: change sock.sk_ino and sock_i_ino() to u64 2026-03-06 14:31:26 +01:00
protocol.c sctp: close UDP tunnel sockets during netns teardown 2026-07-21 14:03:32 -07:00
sm_make_chunk.c sctp: fix soft lockup from unpadded ASCONF-ACK parameter iteration 2026-08-30 14:14:09 -07:00
sm_sideeffect.c sctp: hold asoc or transport before mod_timer() in timer handlers 2026-09-22 18:36:36 -07:00
sm_statefuns.c sctp: discard the rest of the packet on a stale-cookie error 2026-09-22 18:31:01 -07:00
sm_statetable.c
socket.c sctp: check RCV_SHUTDOWN after the sendmsg connect wait 2026-09-30 16:55:47 -07:00
stream_interleave.c
stream_sched_fc.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream_sched_prio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
stream_sched_rr.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream_sched.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream.c sctp: fix stream->outcnt underflow on duplicate RECONF responses 2026-08-25 13:33:08 +02:00
sysctl.c net: Const qualify ctl_tables that kmemdup unconditionally 2026-08-13 13:12:24 +02:00
transport.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tsnmap.c
ulpevent.c
ulpqueue.c