qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jiang Wang <jiang.wang@bytedance.com>
To: qemu-devel@nongnu.org
Cc: sgarzare@redhat.com
Subject: [PATCH v1] vsock: don't send messages when vsock device is not started
Date: Fri,  1 Oct 2021 18:42:23 +0000	[thread overview]
Message-ID: <20211001184223.3600083-1-jiang.wang@bytedance.com> (raw)

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 <sgarzare@redhat.com>
Signed-off-by: Jiang Wang <jiang.wang@bytedance.com>
---
 hw/virtio/vhost-vsock-common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
index 4ad6e234ad..64425719a2 100644
--- a/hw/virtio/vhost-vsock-common.c
+++ b/hw/virtio/vhost-vsock-common.c
@@ -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);
-- 
2.20.1



             reply	other threads:[~2021-10-01 18:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 18:42 Jiang Wang [this message]
2021-10-14 10:56 ` [PATCH v1] vsock: don't send messages when vsock device is not started Stefano Garzarella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211001184223.3600083-1-jiang.wang@bytedance.com \
    --to=jiang.wang@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).