Skip to content

Commit

Permalink
net/smc: correct state change for peer closing
Browse files Browse the repository at this point in the history
If some kind of closing is received from the peer while still in
state SMC_INIT, it means the peer has had an active connection and
closed the socket quickly before listen_work finished. This should
not result in a shortcut from state SMC_INIT to state SMC_CLOSED.
This patch adds the socket to the accept queue in state
SMC_APPCLOSEWAIT1. The socket reaches state SMC_CLOSED once being
accepted and closed with smc_release().

Signed-off-by: Ursula Braun <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Ursula Braun authored and davem330 committed Feb 4, 2019
1 parent a5e0431 commit 84b799a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions net/smc/smc_close.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,14 +345,7 @@ static void smc_close_passive_work(struct work_struct *work)

switch (sk->sk_state) {
case SMC_INIT:
if (atomic_read(&conn->bytes_to_rcv) ||
(rxflags->peer_done_writing &&
!smc_cdc_rxed_any_close(conn))) {
sk->sk_state = SMC_APPCLOSEWAIT1;
} else {
sk->sk_state = SMC_CLOSED;
sock_put(sk); /* passive closing */
}
sk->sk_state = SMC_APPCLOSEWAIT1;
break;
case SMC_ACTIVE:
sk->sk_state = SMC_APPCLOSEWAIT1;
Expand Down

0 comments on commit 84b799a

Please sign in to comment.