linux-stable/net/sctp
Jere Leppänen 2191b0c902 sctp: Start shutdown on association restart if in SHUTDOWN-SENT state and socket is closed
[ Upstream commit d3e8e4c118 ]

Commit bdf6fa52f0 ("sctp: handle association restarts when the
socket is closed.") starts shutdown when an association is restarted,
if in SHUTDOWN-PENDING state and the socket is closed. However, the
rationale stated in that commit applies also when in SHUTDOWN-SENT
state - we don't want to move an association to ESTABLISHED state when
the socket has been closed, because that results in an association
that is unreachable from user space.

The problem scenario:

1.  Client crashes and/or restarts.

2.  Server (using one-to-one socket) calls close(). SHUTDOWN is lost.

3.  Client reconnects using the same addresses and ports.

4.  Server's association is restarted. The association and the socket
    move to ESTABLISHED state, even though the server process has
    closed its descriptor.

Also, after step 4 when the server process exits, some resources are
leaked in an attempt to release the underlying inet sock structure in
ESTABLISHED state:

    IPv4: Attempt to release TCP socket in state 1 00000000377288c7

Fix by acting the same way as in SHUTDOWN-PENDING state. That is, if
an association is restarted in SHUTDOWN-SENT state and the socket is
closed, then start shutdown and don't move the association or the
socket to ESTABLISHED state.

Fixes: bdf6fa52f0 ("sctp: handle association restarts when the socket is closed.")
Signed-off-by: Jere Leppänen <jere.leppanen@nokia.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-06-03 08:19:23 +02:00
..
associola.c sctp: cache netns in sctp_ep_common 2019-12-05 09:21:32 +01:00
auth.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
bind_addr.c
chunk.c sctp: frag_point sanity check 2019-12-13 08:52:29 +01:00
debug.c
diag.c inet_diag: return classid for all socket types 2020-03-18 07:14:11 +01:00
endpointola.c sctp: cache netns in sctp_ep_common 2019-12-05 09:21:32 +01:00
input.c sctp: add chunks to sk_backlog when the newsk sk_socket is not set 2020-01-27 14:51:17 +01:00
inqueue.c sctp: fix the issue that the cookie-ack with auth can't get processed 2018-05-02 11:15:33 -04:00
ipv6.c net: ipv6: add net argument to ip6_dst_lookup_flow 2020-04-29 16:31:16 +02:00
Kconfig sctp: whitespace fixes 2018-07-24 14:10:42 -07:00
Makefile
objcnt.c proc: introduce proc_create_seq{,_data} 2018-05-16 07:23:35 +02:00
offload.c sctp: call gso_reset_checksum when computing checksum in sctp_gso_segment 2019-02-27 10:08:58 +01:00
output.c sctp: increase sk_wmem_alloc when head->truesize is increased 2019-12-13 08:52:00 +01:00
outqueue.c sctp: define SCTP_SS_DEFAULT for Stream schedulers 2018-11-23 08:17:06 +01:00
primitive.c
proc.c sctp: remove useless start_fail from sctp_ht_iter in proc 2018-08-27 15:13:17 -07:00
protocol.c sctp: fix possibly using a bad saddr with a given dst 2020-04-13 10:44:58 +02:00
sm_make_chunk.c sctp: Fix SHUTDOWN CTSN Ack in the peer restart case 2020-05-10 10:30:10 +02:00
sm_sideeffect.c sctp: Don't add the shutdown timer if its already been added 2020-06-03 08:19:21 +02:00
sm_statefuns.c sctp: Start shutdown on association restart if in SHUTDOWN-SENT state and socket is closed 2020-06-03 08:19:23 +02:00
sm_statetable.c
socket.c sctp: fix refcount bug in sctp_wfree 2020-04-13 10:44:57 +02:00
stream.c sctp: fix memleak in sctp_send_reset_streams 2019-08-25 10:48:04 +02:00
stream_interleave.c net/sctp: Make wrappers for accessing in/out streams 2018-08-11 12:25:15 -07:00
stream_sched.c net/sctp: Make wrappers for accessing in/out streams 2018-08-11 12:25:15 -07:00
stream_sched_prio.c net/sctp: Make wrappers for accessing in/out streams 2018-08-11 12:25:15 -07:00
stream_sched_rr.c net/sctp: Make wrappers for accessing in/out streams 2018-08-11 12:25:15 -07:00
sysctl.c
transport.c net: add bool confirm_neigh parameter for dst_ops.update_pmtu 2020-01-04 19:13:37 +01:00
tsnmap.c
ulpevent.c sctp: remove sctp_chunk_put from fail_mark err path in sctp_ulpevent_make_rcvmsg 2018-05-10 17:48:36 -04:00
ulpqueue.c