On Sat, Nov 28, 2026 at 2:49 AM <netd…@kernel.org> wrote:
>
> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
>
> Critical: 0 · High: 1 · Medium: 1 · Low: 1
>
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
>
> - [High] The patch only partly closes the bug class it claims to fix.
> - [Medium] The patch sends a second delete into the keep-last branch of
> sctp_send_asconf_del_ip() (net/sctp/socket.c:863-896) while the first…
> - [Low] Two comments no longer match the patched code: - The header
> comment of sctp_find_unmatch_addr() (net/sctp/bind_addr.c:429-431)…
>
> --
>
> sctp: don't count pending-deleted addresses as survivors on bindx del
>
> This patch makes sctp_find_unmatch_addr() skip entries that are already
> marked SCTP_ADDR_DEL. Two bindx deletes in a row, with unacknowledged
> ASCONFs, should then no longer be able to empty the association's bind
> address list. When no undeleted survivor is left, the keep-last handling
> in sctp_send_asconf_del_ip() is used instead.
>
> > 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;
>
> [Severity: High]
> Can the SCTP_ADDR_DEL mark be overwritten while its delete is still
> queued?
>
> The new check relies only on laddr->state. However,
> sctp_asconf_param_success() sets the state back to SRC on a successful
> ADD_IP ack, without checking the current state:
>
> net/sctp/sm_make_chunk.c:sctp_asconf_param_success() {
> ...
> case SCTP_PARAM_ADD_IP:
> ...
> list_for_each_entry(saddr, &bp->address_list, list) {
> if (sctp_cmp_addr_exact(&saddr->a, &addr))
> saddr->state = SCTP_ADDR_SRC;
> }
> ...
> }
>
> Take an association whose list is only A(SRC). The endpoint also holds a
> third address D, which is needed to pass the endpoint-level check in
> sctp_bindx_rem(). The reproducer in the commit message needs the same
> thing.
>
> bindx ADD B
> B is SCTP_ADDR_NEW, ASCONF1 (ADD B) sent
> bindx DEL B
> sctp_find_unmatch_addr() returns A
> ASCONF2 (DEL B) queued behind ASCONF1, B marked SCTP_ADDR_DEL
> peer acks ASCONF1
> sctp_asconf_param_success() sets B back to SCTP_ADDR_SRC
> ASCONF2 sent, peer holds the ack
> bindx DEL A
> B is SRC, so the new check doesn't skip it; B returned as survivor
> keep-last branch skipped, ASCONF3 (DEL A) queued, A marked DEL
> peer acks ASCONF2 and ASCONF3
> sctp_del_bind_addr() runs for B and A, asoc list is now empty
>
> sctp_sf_do_asconf_ack() matches acks by serial number only.
>
> The next bindx ADD then reaches sctp_send_asconf_add_ip(). It takes the
> first entry without checking whether the list is empty:
>
> net/sctp/socket.c:sctp_send_asconf_add_ip() {
> ...
> bp = &asoc->base.bind_addr;
> p = bp->address_list.next;
> laddr = list_entry(p, struct sctp_sockaddr_entry, list);
> chunk = sctp_make_asconf_update_ip(asoc, &laddr->a, addrs,
> ...
> }
>
> Wouldn't this hit the same NULL af dereference in sctp_make_asconf(), and
> the same diag leak, that the commit message describes?
>
> Could pending deletes be tracked in a way the ADD-ack path can't reset?
> For example, sctp_asconf_param_success() could skip entries that are
> SCTP_ADDR_DEL. Or the survivor check could look at the queued and
> outstanding DEL params.
>
This looks a legit one and makes your fix incomplete,
please confirm and maybe fix it by adding the check:
list_for_each_entry(saddr, &bp->address_list, list) {
- if (sctp_cmp_addr_exact(&saddr->a, &addr))
+ if (sctp_cmp_addr_exact(&saddr->a, &addr) &&
+ saddr->state != SCTP_ADDR_DEL)
saddr->state = SCTP_ADDR_SRC;
}
in sctp_asconf_param_success(), as suggested.
> [Severity: Medium]
> Is the keep-last branch really the same as the single-address case here?
>
> With this change, a second delete issued while the first DEL ASCONF is
> still outstanding goes into the keep-last branch of
> sctp_send_asconf_del_ip(), which does:
>
> asoc->src_out_of_asoc_ok = 1;
> stored = 1;
> goto skip_mkasconf;
>
> sctp_process_asconf_ack() clears that flag on any error-free ack, even if
> asconf_addr_del_pending is still set:
>
> net/sctp/sm_make_chunk.c:sctp_process_asconf_ack() {
> ...
> if (no_err && asoc->src_out_of_asoc_ok) {
> asoc->src_out_of_asoc_ok = 0;
> sctp_transport_immediate_rtx(asoc->peer.primary_path);
> }
> ...
> }
>
> Take an association with [A(SRC), B(SRC)]:
>
> bindx DEL A
> ASCONF(DEL A) sent, A marked DEL
> bindx DEL B
> patched sctp_find_unmatch_addr() skips A, returns NULL
> keep-last: pending = B, src_out_of_asoc_ok = 1, B marked DEL
> peer acks DEL A, delayed only by normal RTT
> A removed, pending B kept (no match), src_out_of_asoc_ok cleared
>
> That leaves the association with [B(DEL)] and src_out_of_asoc_ok == 0.
>
> sctp_v4_get_dst() then rejects every candidate source address, and the
> IPv6 version does the same:
>
> if (!laddr->valid || (laddr->state == SCTP_ADDR_DEL) ||
> (laddr->state != SCTP_ADDR_SRC &&
> !asoc->src_out_of_asoc_ok))
> continue;
>
> sctp_packet_transmit() drops packets when tp->dst is NULL.
>
> Keep-last relies on a later bindx ADD C to recover, by sending
> ASCONF(ADD C, DEL B). That ASCONF doesn't look like it can be sent
> either:
>
> - C is SCTP_ADDR_NEW, so it can't be a source address without
> src_out_of_asoc_ok.
> - The transport reset block in sctp_send_asconf_add_ip() runs only when
> asoc->src_out_of_asoc_ok is set, so it is skipped.
>
> Can the association do anything other than stall until the
> retransmission limits abort it?
>
> The clear-on-any-ack logic is older than this patch. Still, the commit
> message's "same as it already does for a single-address delete" relies on
> it.
asoc->src_out_of_asoc_ok must not be cleared if there's still a del-pending
address. As there's no available src address, sctp_v4_get_dst() must use
the new adding addr, clearing asoc->src_out_of_asoc_ok will cause that
src addr (f) not to be used due to the check:
if (!laddr->valid || (laddr->state == SCTP_ADDR_DEL) ||
(laddr->state != SCTP_ADDR_SRC &&
!asoc->src_out_of_asoc_ok))
continue;
Please fix it by clearing it only when asoc->asconf_addr_del_pending is NULL
in sctp_process_asconf_ack(), like:
- if (no_err && asoc->src_out_of_asoc_ok) {
+ if (no_err && asoc->src_out_of_asoc_ok &&
+ !asoc->asconf_addr_del_pending) {
asoc->src_out_of_asoc_ok = 0;
sctp_transport_immediate_rtx(asoc->peer.primary_path);
}
Thanks.
pw-bot: cr
> [Severity: Low]
> This isn't a bug, but the header comment of sctp_find_unmatch_addr() still
> says:
>
> /* Find the first address in the bind address list that is not present in
> * the addrs packed array.
> */
>
> With this change the function also skips SCTP_ADDR_DEL entries. It can
> return NULL even when an unmatched address exists.
>
> Should this comment be updated? The same applies to the "Find one address
> in the association's bind address list that is not in the packed array of
> addresses" comment in sctp_send_asconf_del_ip().
>
> --
> Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40gmail.com