Message ID | 20200530123936.63480-1-justin.he@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v5] virtio_vsock: Fix race condition in virtio_transport_recv_pkt | expand |
> --- > v5: sorry, MIME type in the previous commit message > > net/vmw_vsock/virtio_transport_common.c | 8 ++++++++ Is it helpful to keep the patch version information complete here? (Will another fine-tuning follow for the proposed change?) Regards, Markus
diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c index 69efc891885f..0edda1edf988 100644 --- a/net/vmw_vsock/virtio_transport_common.c +++ b/net/vmw_vsock/virtio_transport_common.c @@ -1132,6 +1132,14 @@ void virtio_transport_recv_pkt(struct virtio_transport *t, lock_sock(sk); + /* Check if sk has been released before lock_sock */ + if (sk->sk_shutdown == SHUTDOWN_MASK) { + (void)virtio_transport_reset_no_sock(t, pkt); + release_sock(sk); + sock_put(sk); + goto free_pkt; + } + /* Update CID in case it has changed after a transport reset event */ vsk->local_addr.svm_cid = dst.svm_cid;