sctp: prevent peer transport count overflow
Subsystems (3)
PATCH 1/1 sctp: prevent peer transport count overflow
sctp_assoc_add_peer() increments the association's 16-bit transport_count for every new unique peer. Adding the 65,536th transport wraps the count to zero.
SCTP sock_diag uses transport_count to reserve the INET_DIAG_PEERS payload, then copies one sockaddr_storage for every entry in transport_addr_list. After the wrap, a diagnostic dump reserves an empty payload and writes 8 MiB of peer addresses past the skb tail.
Reject a new unique peer when transport_count has reached U16_MAX. Perform the check after the existing-peer lookup so a duplicate address continues to return its existing transport at the limit.
--- net/sctp/associola.c | 3 +++ 1 file changed, 3 insertions(+)
net/sctp/associola.c +3 -0
@@ -614,6 +614,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,return peer; } +if (asoc->peer.transport_count ==U16_MAX ) +return NULL ; + peer =sctp_transport_new (asoc->base.net, addr, gfp);if (!peer)return NULL ;
Signature · 1 line
2.53.0
Quoted 37 lines · Asim Viladi Oglu Manizada
sctp_assoc_add_peer()increments the association's 16-bittransport_countfor every new unique peer. Adding the 65,536th transport wraps the count to zero.SCTP
sock_diagusestransport_countto reserve theINET_DIAG_PEERSpayload, then copies onesockaddr_storagefor every entry intransport_addr_list. After the wrap, a diagnostic dump reserves an empty payload and writes 8 MiB of peer addresses past the skb tail.Reject a new unique peer when
transport_counthas reachedU16_MAX. Perform the check after the existing-peer lookup so a duplicate address continues to return its existing transport at the limit.Fixes 8f840e47f190 ("sctp: add the sctp_diag.c file")Assisted-by avom-custom-harness:gpt-5.5-qwen3.6-mod-mixSigned-off-by Asim Viladi Oglu Manizada <[email protected]>--- net/sctp/associola.c | 3 +++ 1 file changed, 3 insertions(+)net/sctp/associola.c +3
-1@@ -614,6 +614,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,return peer; } +if (asoc->peer.transport_count ==U16_MAX ) +return NULL ; + peer =sctp_transport_new (asoc->base.net, addr, gfp);if (!peer)return NULL ; --
Quoted 2 lines
2.53.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Sat, 25 Jul 2026 03:21:06 +0000 you wrote:
sctp_assoc_add_peer()increments the association's 16-bittransport_countfor every new unique peer. Adding the 65,536th transport wraps the count to zero.SCTP
sock_diagusestransport_countto reserve theINET_DIAG_PEERSpayload, then copies onesockaddr_storagefor every entry intransport_addr_list. After the wrap, a diagnostic dump reserves an empty payload and writes 8 MiB of peer addresses past the skb tail.[...]
Here is the summary with links:
- [net] sctp: prevent peer transport count overflow
https://git.kernel.org/netdev/net/c/bd0e9289e264
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html