* [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup
@ 2026-11-24 2:21 Lin Jiapeng
2026-11-25 17:50 ` Xin Long
2026-11-30 3:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Lin Jiapeng @ 2026-11-24 2:21 UTC (permalink / raw)
To: marcelo.leitner, lucien.xin, davem, edumazet, kuba, pabeni, horms,
vladislav.yasevich, linux-sctp, netdev, linux-kernel
Cc: Lin Jiapeng, stable, TencentOS Corvus AI
From: Lin Jiapeng <jiapenglin@tencent.com>
sctp_process_init() removes non-ACTIVE peer transports when INIT processing
fails. The transport matching peer_addr may itself be UNCONFIRMED, because
sctp_assoc_add_peer() only promotes an existing UNKNOWN transport to
ACTIVE.
If no ACTIVE transport remains, the cleanup can remove the last transport.
sctp_assoc_rm_peer() then interprets the empty list head as a transport and
passes the invalid replacement to sctp_assoc_set_primary(). KASAN reports a
null-ptr-deref in sctp_ulpevent_notify_peer_addr_change() through
sctp_assoc_rm_peer() and sctp_process_init().
Keep the transport matching peer_addr while removing the other non-ACTIVE
transports. This preserves a valid replacement path without retaining an
arbitrary UNCONFIRMED address from failed INIT processing. On a live
COOKIE_WAIT association, T1-init remains armed and can continue using the
retained transport until association teardown. Successful INIT processing
is unchanged.
Fixes: add52379dde2 ("sctp: Fix oops when INIT-ACK indicates that peer doesn't support AUTH")
Cc: stable@vger.kernel.org
Reported-by: TencentOS Corvus AI <corvus@tencent.com>
Link: https://lore.kernel.org/netdev/20261112092114.12458-1-ljp1205831794@gmail.com/
Signed-off-by: Lin Jiapeng <jiapenglin@tencent.com>
---
v2:
- Keep the transport matching peer_addr instead of an arbitrary last
transport, as suggested by Xin Long.
- Update the subject, cleanup comment, and commit message to describe the
retained transport's use by a live COOKIE_WAIT association.
net/sctp/sm_make_chunk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 15c2d87575a8..65594eaaeacd 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -2525,10 +2525,14 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
return 1;
clean_up:
- /* Release the transport structures. */
+ /*
+ * Release non-ACTIVE transports except the one for peer_addr.
+ * Keep it so sctp_assoc_rm_peer() always has a replacement path.
+ */
list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
- if (transport->state != SCTP_ACTIVE)
+ if (transport->state != SCTP_ACTIVE &&
+ !sctp_cmp_addr_exact(&transport->ipaddr, peer_addr))
sctp_assoc_rm_peer(asoc, transport);
}
base-commit: 145480b28ca82e9fae789427cc4569e596515a32
--
2.55.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup
2026-11-24 2:21 [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup Lin Jiapeng
@ 2026-11-25 17:50 ` Xin Long
2026-11-30 3:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Xin Long @ 2026-11-25 17:50 UTC (permalink / raw)
To: Lin Jiapeng
Cc: marcelo.leitner, davem, edumazet, kuba, pabeni, horms,
vladislav.yasevich, linux-sctp, netdev, linux-kernel, Lin Jiapeng,
stable, TencentOS Corvus AI
On Mon, Nov 23, 2026 at 9:21 PM Lin Jiapeng <ljp1205831794@gmail.com> wrote:
>
> From: Lin Jiapeng <jiapenglin@tencent.com>
>
> sctp_process_init() removes non-ACTIVE peer transports when INIT processing
> fails. The transport matching peer_addr may itself be UNCONFIRMED, because
> sctp_assoc_add_peer() only promotes an existing UNKNOWN transport to
> ACTIVE.
>
> If no ACTIVE transport remains, the cleanup can remove the last transport.
> sctp_assoc_rm_peer() then interprets the empty list head as a transport and
> passes the invalid replacement to sctp_assoc_set_primary(). KASAN reports a
> null-ptr-deref in sctp_ulpevent_notify_peer_addr_change() through
> sctp_assoc_rm_peer() and sctp_process_init().
>
> Keep the transport matching peer_addr while removing the other non-ACTIVE
> transports. This preserves a valid replacement path without retaining an
> arbitrary UNCONFIRMED address from failed INIT processing. On a live
> COOKIE_WAIT association, T1-init remains armed and can continue using the
> retained transport until association teardown. Successful INIT processing
> is unchanged.
>
> Fixes: add52379dde2 ("sctp: Fix oops when INIT-ACK indicates that peer doesn't support AUTH")
> Cc: stable@vger.kernel.org
> Reported-by: TencentOS Corvus AI <corvus@tencent.com>
> Link: https://lore.kernel.org/netdev/20261112092114.12458-1-ljp1205831794@gmail.com/
> Signed-off-by: Lin Jiapeng <jiapenglin@tencent.com>
> ---
> v2:
> - Keep the transport matching peer_addr instead of an arbitrary last
> transport, as suggested by Xin Long.
> - Update the subject, cleanup comment, and commit message to describe the
> retained transport's use by a live COOKIE_WAIT association.
>
> net/sctp/sm_make_chunk.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 15c2d87575a8..65594eaaeacd 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -2525,10 +2525,14 @@ int sctp_process_init(struct sctp_association *asoc, struct sctp_chunk *chunk,
> return 1;
>
> clean_up:
> - /* Release the transport structures. */
> + /*
> + * Release non-ACTIVE transports except the one for peer_addr.
> + * Keep it so sctp_assoc_rm_peer() always has a replacement path.
> + */
> list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
> transport = list_entry(pos, struct sctp_transport, transports);
> - if (transport->state != SCTP_ACTIVE)
> + if (transport->state != SCTP_ACTIVE &&
> + !sctp_cmp_addr_exact(&transport->ipaddr, peer_addr))
> sctp_assoc_rm_peer(asoc, transport);
> }
>
>
> base-commit: 145480b28ca82e9fae789427cc4569e596515a32
> --
> 2.55.0
>
Acked-by: Xin Long <lucien.xin@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup
2026-11-24 2:21 [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup Lin Jiapeng
2026-11-25 17:50 ` Xin Long
@ 2026-11-30 3:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-30 3:50 UTC (permalink / raw)
To: Lin Jiapeng
Cc: marcelo.leitner, lucien.xin, davem, edumazet, kuba, pabeni, horms,
vladislav.yasevich, linux-sctp, netdev, linux-kernel, jiapenglin,
stable, corvus
Hello:
This patch was applied to netdev/net.git (main)
by Willem de Bruijn <willemb@google.com>:
On Tue, 24 Nov 2026 10:21:00 +0800 you wrote:
> From: Lin Jiapeng <jiapenglin@tencent.com>
>
> sctp_process_init() removes non-ACTIVE peer transports when INIT processing
> fails. The transport matching peer_addr may itself be UNCONFIRMED, because
> sctp_assoc_add_peer() only promotes an existing UNKNOWN transport to
> ACTIVE.
>
> [...]
Here is the summary with links:
- [net,v2] sctp: preserve the peer transport during INIT error cleanup
https://git.kernel.org/netdev/net/c/df41f9ba1ab1
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 3:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 2:21 [PATCH net v2] sctp: preserve the peer transport during INIT error cleanup Lin Jiapeng
2026-11-25 17:50 ` Xin Long
2026-11-30 3:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox