linux/net/sctp
Jun Yang 9b2854f86f sctp: don't free the ASCONF's own transport in DEL-IP processing
sctp_process_asconf() caches the transport the ASCONF chunk is processed
against in asconf->transport (== chunk->transport, set once in sctp_rcv()).
For an ASCONF located through its Address Parameter by
__sctp_rcv_asconf_lookup(), that cached transport corresponds to the
Address Parameter, which need not be the packet's source address.

sctp_process_asconf_param() rejects a DEL-IP for the packet source address
(ADDIP D8, SCTP_ERROR_DEL_SRC_IP), but nothing protects asconf->transport.
A single ASCONF can therefore carry, in order:

    [Address Parameter L] [DEL-IP L] [DEL-IP 0.0.0.0]

where L differs from the source. The DEL-IP for L passes the D8 check and
calls sctp_assoc_rm_peer() on the transport that asconf->transport still
points at, freeing it (RCU-deferred). The following wildcard DEL-IP then
reuses the now-dangling asconf->transport in sctp_assoc_set_primary() and
sctp_assoc_del_nonprimary_peers(): set_primary() dereferences the freed
transport (->ipaddr, ->state) and plants the dangling pointer into
asoc->peer.primary_path / active_path, and del_nonprimary_peers(), keeping
only the pointer that is no longer on the list, removes every real
transport, leaving the association with a transport_count of 0 and
primary_path/active_path pointing at freed memory.

Reject a DEL-IP that targets the transport the ASCONF is being processed
against, mirroring the existing source-address guard, so the wildcard
branch can never reuse a freed transport.

Fixes: 42e30bf346 ("[SCTP]: Handle the wildcard ADD-IP Address parameter")
Cc: stable@kernel.org
Signed-off-by: Jun Yang <junvyyang@tencent.com>
Acked-by: Xin Long <lucien.xin@gmail.com>
Link: https://patch.msgid.link/tencent_73762ED1DF08CC9D5F5F61954B01350CFE0A@qq.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-07-23 10:30:31 -07:00
..
associola.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
auth.c sctp: fix auth_chunk_list capacity check in sctp_auth_ep_add_chunkid 2026-07-21 12:30:38 -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: Fix typo in comment 2026-05-08 16:51:37 -07:00
input.c sctp: fix uninit-value in __sctp_rcv_asconf_lookup() 2026-06-09 18:12:30 -07:00
inqueue.c sctp: fix missing encap_port propagation for GSO fragments 2026-04-13 16:49:37 -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 treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
outqueue.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02: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: don't free the ASCONF's own transport in DEL-IP processing 2026-07-23 10:30:31 -07:00
sm_sideeffect.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sm_statefuns.c sctp: auth: verify auth requirement when auth_chunk is NULL 2026-07-22 13:16:08 -07:00
sm_statetable.c
socket.c sctp: fix SCTP_RESET_STREAMS stream list length limit 2026-06-27 15:39:35 -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: validate stream count in sctp_process_strreset_inreq() 2026-07-21 13:47:38 -07:00
sysctl.c sctp: avoid auth_enable sysctl UAF during netns teardown 2026-07-21 14:03:32 -07: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