mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-22 07:53:11 -05:00
vsock: reset socket state when de-assigning the transport
Transport's release() and destruct() are called when de-assigning the
vsock transport. These callbacks can touch some socket state like
sock flags, sk_state, and peer_shutdown.
Since we are reassigning the socket to a new transport during
vsock_connect(), let's reset these fields to have a clean state with
the new transport.
Fixes: c0cfa2d8a7
("vsock: add multi-transports support")
Cc: stable@vger.kernel.org
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
df137da9d6
commit
a24009bc9b
1 changed files with 9 additions and 0 deletions
|
@ -491,6 +491,15 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
|
||||||
*/
|
*/
|
||||||
vsk->transport->release(vsk);
|
vsk->transport->release(vsk);
|
||||||
vsock_deassign_transport(vsk);
|
vsock_deassign_transport(vsk);
|
||||||
|
|
||||||
|
/* transport's release() and destruct() can touch some socket
|
||||||
|
* state, since we are reassigning the socket to a new transport
|
||||||
|
* during vsock_connect(), let's reset these fields to have a
|
||||||
|
* clean state.
|
||||||
|
*/
|
||||||
|
sock_reset_flag(sk, SOCK_DONE);
|
||||||
|
sk->sk_state = TCP_CLOSE;
|
||||||
|
vsk->peer_shutdown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We increase the module refcnt to prevent the transport unloading
|
/* We increase the module refcnt to prevent the transport unloading
|
||||||
|
|
Loading…
Reference in a new issue