vsock: don't send messages when vsock device is not started
PATCH 1/1 vsock: don't send messages when vsock device is not started
Added a check in vhost_vsock_common_send_transport_reset, and only send messages on event queue when the vsock host device is started.
--- hw/virtio/vhost-vsock-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
hw/virtio/vhost-vsock-common.c +4 -2
@@ -138,8 +138,10 @@ static void vhost_vsock_common_send_transport_reset(VHostVSockCommon *vvc) goto out; } -virtqueue_push (vq, elem,sizeof (event)); -virtio_notify (VIRTIO_DEVICE (vvc), vq); +if (vvc->vhost_dev.started) { +virtqueue_push (vq, elem,sizeof (event)); +virtio_notify (VIRTIO_DEVICE (vvc), vq); + } out:g_free (elem);
Signature · 1 line
2.20.1
Please CC maintainers (MST in this case)
Quoted 21 lines · Jiang Wang
Added a check in
vhost_vsock_common_send_transport_reset, and only send messages on event queue when the vsock host device is started.Suggested-by Stefano Garzarella <[email protected]>Signed-off-by Jiang Wang <[email protected]>---
hw/virtio/vhost-vsock-common.c | 6 ++++--1 file changed, 4 insertions(+), 2 deletions(-)hw/virtio/vhost-vsock- renamed from hw/virtio/vhost-vsock-common.c +0
-0
common.c
index4ad6e234ad..64425719a2100644hw/virtio/vhost-vsock-common.c +0
-0@@ -138,8 +138,10 @@ static void vhost_vsock_common_send_transport_reset(VHostVSockCommon *vvc) goto out; }
-virtqueue_push(vq, elem, sizeof(event));
Quoted 8 lines
-
virtio_notify(VIRTIO_DEVICE(vvc), vq);
+ if (vvc->vhost_dev.started) {
+virtqueue_push(vq, elem, sizeof(event));
+virtio_notify(VIRTIO_DEVICE(vvc), vq);
+ }
out:
g_free(elem);
I agree that we should avoid to enqueue reset messages if the device is not started, but this change is wrong, because we are still doing virtqueue_pop().
I think we should skip vhost_vsock_common_send_transport_reset() entirely.
Thanks,
Stefano