linux/net/sctp
Xin Long 4d5c70e615 sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start
If hashing fails in sctp_listen_start(), the socket remains in the
LISTENING state, even though it was not added to the hash table.
This can lead to a scenario where a socket appears to be listening
without actually being accessible.

This patch ensures that if the hashing operation fails, the sk_state
is set back to CLOSED before returning an error.

Note that there is no need to undo the autobind operation if hashing
fails, as the bind port can still be used for next listen() call on
the same socket.

Fixes: 76c6d988ae ("sctp: add sock_reuseport for the sock in __sctp_hash_endpoint")
Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2024-10-09 13:36:32 +01:00
..
associola.c sctp: update transport state when processing a dupcook packet 2023-10-04 17:29:44 -07:00
auth.c
bind_addr.c
chunk.c
debug.c
diag.c inet_diag: add module pointer to "struct inet_diag_handler" 2024-01-23 15:13:54 +01:00
endpointola.c
input.c sctp: Fix null-ptr-deref in reuseport_add_sock(). 2024-08-02 16:25:06 -07:00
inqueue.c net: sctp: fix skb leak in sctp_inq_free() 2024-02-15 07:34:52 -08:00
ipv6.c ipv6: introduce dst_rt6_info() helper 2024-04-29 13:32:01 +01:00
Kconfig
Makefile
objcnt.c
offload.c
output.c
outqueue.c
primitive.c
proc.c sctp: annotate data-races around sk->sk_wmem_queued 2023-08-31 11:56:59 +02:00
protocol.c sctp: Unmask upper DSCP bits in sctp_v4_get_dst() 2024-09-09 14:14:53 +01:00
sm_make_chunk.c sctp: Spelling s/preceeding/preceding/g 2023-10-04 14:04:58 -07:00
sm_sideeffect.c sctp: handle invalid error codes without calling BUG() 2023-06-12 09:36:27 +01:00
sm_statefuns.c sctp: fix association labeling in the duplicate COOKIE-ECHO case 2024-08-27 16:07:12 -07:00
sm_statetable.c
socket.c sctp: ensure sk_state is set to CLOSED if hashing fails in sctp_listen_start 2024-10-09 13:36:32 +01:00
stream_interleave.c
stream_sched_fc.c
stream_sched_prio.c
stream_sched_rr.c
stream_sched.c
stream.c
sysctl.c sysctl: treewide: constify the ctl_table argument of proc_handlers 2024-07-24 20:59:29 +02:00
transport.c
tsnmap.c
ulpevent.c
ulpqueue.c