linux/net/sctp
Xin Long 7c9b012d63 sctp: fix sockets_allocated imbalance after sk_clone()
sk_clone() increments sockets_allocated and sets the socket refcount to 2.
SCTP performs additional accounting in sctp_clone_sock(), so the clone-time
increment must be undone to avoid double counting.

Note we cannot simply remove the SCTP-side increment, because the SCTP
destroy path in sctp_destroy_sock() only decrements sockets_allocated when
sp->ep is set, which may not be true for all failure paths in
sctp_clone_sock().

Fixes: 16942cf4d3 ("sctp: Use sk_clone() in sctp_accept().")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/af8d66f928dec3e9fcbee8d4a85b7d5a6b86f515.1776460180.git.lucien.xin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-04-22 20:31:24 -07:00
..
associola.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
auth.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
bind_addr.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
chunk.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
debug.c
diag.c sctp: Hold sock lock while iterating over address list 2025-11-03 17:09:36 -08:00
endpointola.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
input.c net: sctp: fix KMSAN uninit-value in sctp_inq_pop 2025-10-30 11:21:05 +01:00
inqueue.c sctp: fix missing encap_port propagation for GSO fragments 2026-04-13 16:49:37 -07:00
ipv6.c sctp: disable BH before calling udp_tunnel_xmit_skb() 2026-04-13 16:50:28 -07:00
Kconfig ipv6: convert CONFIG_IPV6 to built-in only and clean up Kconfigs 2026-03-29 11:21:22 -07:00
Makefile
objcnt.c
offload.c sctp: use skb_crc32c() instead of __skb_checksum() 2025-05-21 15:40:16 -07:00
output.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
outqueue.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
primitive.c
proc.c net: change sock.sk_ino and sock_i_ino() to u64 2026-03-06 14:31:26 +01:00
protocol.c sctp: disable BH before calling udp_tunnel_xmit_skb() 2026-04-13 16:50:28 -07:00
sm_make_chunk.c net: use get_random_u{16,32,64}() where appropriate 2026-04-09 19:27:43 -07:00
sm_sideeffect.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sm_statefuns.c sctp: move SCTP_CMD_ASSOC_SHKEY right after SCTP_CMD_PEER_INIT 2026-01-17 15:10:34 -08:00
sm_statetable.c
socket.c sctp: fix sockets_allocated imbalance after sk_clone() 2026-04-22 20:31:24 -07:00
stream_interleave.c
stream_sched_fc.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream_sched_prio.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
stream_sched_rr.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream_sched.c sctp: Constify struct sctp_sched_ops 2025-10-28 17:50:55 -07:00
stream.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sysctl.c sctp: Stop accepting md5 and sha1 for net.sctp.cookie_hmac_alg 2025-08-19 19:36:26 -07:00
transport.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
tsnmap.c
ulpevent.c
ulpqueue.c