* [PATCH net] sctp: clear control chunk transport if it is being removed
@ 2026-08-05 15:18 Xin Long
2026-08-06 16:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Xin Long @ 2026-08-05 15:18 UTC (permalink / raw)
To: network dev, linux-sctp
Cc: davem, kuba, Eric Dumazet, Paolo Abeni, Simon Horman,
Marcelo Ricardo Leitner, Daniele Linguaglossa
sctp_make_heartbeat_ack() caches the destination transport in
chunk->transport without taking a reference. When src_out_of_asoc_ok is
enabled, the HEARTBEAT ACK may remain queued on control_chunk_list instead
of being transmitted immediately.
If the peer transport is removed while the chunk is still queued,
sctp_assoc_rm_peer() drops the transport and schedules it for RCU freeing,
but only clears cached transport pointers in out_chunk_list. The queued
control chunk therefore retains a dangling transport pointer.
Once an ASCONF_ACK clears the suppression and the queued control chunk is
transmitted, SCTP dereferences the stale transport pointer, leading to a
use-after-free.
Fix this by also clearing chunk->transport for queued control chunks in
control_chunk_list when removing the transport.
Fixes: 8a07eb0a50ae ("sctp: Add ASCONF operation on the single-homed host")
Reported-by: Daniele Linguaglossa <danielelinguaglossa@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/sctp/associola.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index b6ac0966420a..5b0ae616e1ff 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -573,6 +573,10 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
if (ch->transport == peer)
ch->transport = NULL;
+ list_for_each_entry(ch, &asoc->outqueue.control_chunk_list, list)
+ if (ch->transport == peer)
+ ch->transport = NULL;
+
asoc->peer.transport_count--;
sctp_ulpevent_notify_peer_addr_change(peer, SCTP_ADDR_REMOVED, 0);
--
2.47.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] sctp: clear control chunk transport if it is being removed
2026-08-05 15:18 [PATCH net] sctp: clear control chunk transport if it is being removed Xin Long
@ 2026-08-06 16:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-06 16:50 UTC (permalink / raw)
To: Xin Long
Cc: netdev, linux-sctp, davem, kuba, edumazet, pabeni, horms,
marcelo.leitner, danielelinguaglossa
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 5 Aug 2026 11:18:40 -0400 you wrote:
> sctp_make_heartbeat_ack() caches the destination transport in
> chunk->transport without taking a reference. When src_out_of_asoc_ok is
> enabled, the HEARTBEAT ACK may remain queued on control_chunk_list instead
> of being transmitted immediately.
>
> If the peer transport is removed while the chunk is still queued,
> sctp_assoc_rm_peer() drops the transport and schedules it for RCU freeing,
> but only clears cached transport pointers in out_chunk_list. The queued
> control chunk therefore retains a dangling transport pointer.
>
> [...]
Here is the summary with links:
- [net] sctp: clear control chunk transport if it is being removed
https://git.kernel.org/netdev/net/c/c9158ceaf277
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] 2+ messages in thread
end of thread, other threads:[~2026-08-06 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 15:18 [PATCH net] sctp: clear control chunk transport if it is being removed Xin Long
2026-08-06 16: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