Re: [syzbot] [net?] general protection fault in add_wait_queue

From: Jeongjun Park
Date: Mon Feb 03 2025 - 07:54:36 EST


#syz test git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

---
net/vmw_vsock/virtio_transport_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
index 7f7de6d88096..655d5f911c84 100644
--- a/net/vmw_vsock/virtio_transport_common.c
+++ b/net/vmw_vsock/virtio_transport_common.c
@@ -1298,7 +1298,8 @@ void virtio_transport_release(struct vsock_sock *vsk)
struct sock *sk = &vsk->sk;
bool remove_sock = true;

- if (sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET)
+ if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET)
+ && !sock_flag(sk, SOCK_DEAD))
remove_sock = virtio_transport_close(vsk);

if (remove_sock) {
--