From: Henry Martin <bsdhenrymartin@gmail.com>
To: Xin Long <lucien.xin@gmail.com>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Vlad Yasevich <vladislav.yasevich@hp.com>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@kernel.org>,
Simon Horman <horms@kernel.org>
Cc: linux-sctp@vger.kernel.org, netdev@vger.kernel.org,
Henry Martin <bsdhenrymartin@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH net] sctp: don't count pending-deleted addresses as survivors on bindx del
Date: Fri, 27 Nov 2026 14:50:17 +0800 [thread overview]
Message-ID: <20261127065017.2922776-1-bsdhenrymartin@gmail.com> (raw)
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
reply other threads:[~2026-11-27 6:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127065017.2922776-1-bsdhenrymartin@gmail.com \
--to=bsdhenrymartin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=vladislav.yasevich@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox