Skip to content

Commit

Permalink
VSOCK: Don't set sk_state to TCP_CLOSE before testing it
Browse files Browse the repository at this point in the history
A recent commit (3b4477d) converted the sk_state to use
TCP constants. In that change, vmci_transport_handle_detach
was changed such that sk->sk_state was set to TCP_CLOSE before
we test whether it is TCP_SYN_SENT. This change moves the
sk_state change back to the original locations in that function.

Signed-off-by: Jorgen Hansen <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jorgen Hansen authored and davem330 committed Nov 28, 2017
1 parent 22dac9f commit 4a5def7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/vmw_vsock/vmci_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ static void vmci_transport_handle_detach(struct sock *sk)
*/
if (vsk->local_addr.svm_cid == VMADDR_CID_HOST ||
vsock_stream_has_data(vsk) <= 0) {
sk->sk_state = TCP_CLOSE;

if (sk->sk_state == TCP_SYN_SENT) {
/* The peer may detach from a queue pair while
* we are still in the connecting state, i.e.,
Expand All @@ -815,10 +813,12 @@ static void vmci_transport_handle_detach(struct sock *sk)
* event like a reset.
*/

sk->sk_state = TCP_CLOSE;
sk->sk_err = ECONNRESET;
sk->sk_error_report(sk);
return;
}
sk->sk_state = TCP_CLOSE;
}
sk->sk_state_change(sk);
}
Expand Down

0 comments on commit 4a5def7

Please sign in to comment.