Skip to contentSkip to conversation

VSOCK: Don't set sk_state to TCP_CLOSE before testing it

PATCH Applied Jorgen Hansen 3 participants 4 messages Nov 27, 2017 – Nov 28, 2017

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VSOCK: Don't set sk_state to TCP_CLOSE before testing it

A recent commit (3b4477d2dcf2) 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.

---
 net/vmw_vsock/vmci_transport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/vmw_vsock/vmci_transport.c +2 -2
index 56573dc..a7a73ff 100644
@@ -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.,
@@ -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);
 	}
Signature · 1 line
2.6.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jorgen Hansen

A recent commit (3b4477d2dcf2) 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.

---
 net/vmw_vsock/vmci_transport.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Sorry, silly bug on my part!

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

maintainer Applied
#2 lore raw
In reply to Jorgen Hansen

From: Jorgen Hansen <[email protected]>
Date: Mon, 27 Nov 2017 05:29:32 -0800

Quoted 7 lines

A recent commit (3b4477d2dcf2) 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.

Applied.

maintainer Applied
#3 lore raw
In reply to Jorgen Hansen

From: Jorgen Hansen <[email protected]>
Date: Mon, 27 Nov 2017 05:29:32 -0800

Quoted 7 lines

A recent commit (3b4477d2dcf2) 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.

Applied.