* [PATCH net] sctp: don't count pending-deleted addresses as survivors on bindx del
@ 2026-11-27 6:50 Henry Martin
0 siblings, 0 replies; only message in thread
From: Henry Martin @ 2026-11-27 6:50 UTC (permalink / raw)
To: Xin Long, Marcelo Ricardo Leitner, Vlad Yasevich,
David S . Miller, Jakub Kicinski, Paolo Abeni, Eric Dumazet,
Simon Horman
Cc: linux-sctp, netdev, Henry Martin, stable
sctp_send_asconf_del_ip() uses sctp_find_unmatch_addr() to make sure a
bindx delete keeps at least one address in the association. The lookup
counts entries that are already marked SCTP_ADDR_DEL by a previous
delete request as survivors. With a peer that holds back the ASCONF
acks, two sequential bindx deletes each pass the check while together
marking every address for deletion. Once the peer acks both deletes,
the association's address list is empty.
An empty address list breaks its consumers. SCTP diag reads the list
head as an address and returns 16 bytes of association memory in
idiag_src. A following bindx add builds an ASCONF from a bogus address
taken from the empty list head, whose address family matches no sctp_af,
and dereferences a NULL af pointer.
e.g. on mainline v7.4-rc4 (KASAN build):
Oops: general protection fault (non-canonical 0xdffffc000000000b)
KASAN: null-ptr-deref in range [0x0000000000000058-0x000000000000005f]
CPU: 1 UID: 1000 PID: 81 Comm: poc-crash Not tainted 7.4.0-rc4 #1
RIP: 0010:sctp_make_asconf+0xd9/0x280
Call Trace:
sctp_make_asconf_update_ip+0x243/0x540
sctp_send_asconf_add_ip+0x366/0xc90
sctp_setsockopt+0x1986/0x9410
do_sock_setsockopt+0xb2/0x160
__sys_setsockopt+0xdd/0x140
An address that is already being deleted cannot serve as the remaining
address, so skip SCTP_ADDR_DEL entries in the survivor lookup. The
existing keep-last handling then holds the final address back, same as
it already does for a single-address delete.
This issue was discovered by Tencent CodeBuddy Security.
Cc: stable@vger.kernel.org
Fixes: f57d96b2e92d ("[SCTP]: Change use_as_src into a full address state")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
net/sctp/bind_addr.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/sctp/bind_addr.c b/net/sctp/bind_addr.c
index 31737f144c7f0..e20006b9f12e4 100644
--- a/net/sctp/bind_addr.c
+++ b/net/sctp/bind_addr.c
@@ -445,6 +445,12 @@ union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp,
* can't change.
*/
list_for_each_entry(laddr, &bp->address_list, list) {
+ /* An address already being deleted cannot serve as the
+ * one remaining address.
+ */
+ if (laddr->state == SCTP_ADDR_DEL)
+ continue;
+
addr_buf = (union sctp_addr *)addrs;
for (i = 0; i < addrcnt; i++) {
addr = addr_buf;
--
2.39.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-27 6:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 6:50 [PATCH net] sctp: don't count pending-deleted addresses as survivors on bindx del Henry Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox