Skip to content

Commit 02a4893

Browse files
committed
vsock: reset socket state when de-assigning the transport
jira VULN-80682 jira VULN-80681 cve-bf CVE-2025-38461 commit-author Stefano Garzarella <sgarzare@redhat.com> commit a24009b 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: c0cfa2d ("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> (cherry picked from commit a24009b) Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
1 parent 0b1eeaf commit 02a4893

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/vmw_vsock/af_vsock.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,15 @@ int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk)
491491
*/
492492
vsk->transport->release(vsk);
493493
vsock_deassign_transport(vsk);
494+
495+
/* transport's release() and destruct() can touch some socket
496+
* state, since we are reassigning the socket to a new transport
497+
* during vsock_connect(), let's reset these fields to have a
498+
* clean state.
499+
*/
500+
sock_reset_flag(sk, SOCK_DONE);
501+
sk->sk_state = TCP_CLOSE;
502+
vsk->peer_shutdown = 0;
494503
}
495504

496505
/* We increase the module refcnt to prevent the transport unloading

0 commit comments

Comments
 (0)