From: Yi Wang <wang.yi59@zte.com.cn>
To: mst@redhat.com
Cc: wang.yi59@zte.com.cn, wang.liang82@zte.com.cn,
Cheng Lin <cheng.lin130@zte.com.cn>,
qemu-devel@nongnu.org, xue.zhihong@zte.com.cn
Subject: [PATCH] virtio: add check for inconsistent VQ in virtio_save()
Date: Wed, 30 Oct 2019 16:09:47 +0800 [thread overview]
Message-ID: <1572422987-19683-1-git-send-email-wang.yi59@zte.com.cn> (raw)
From: Cheng Lin <cheng.lin130@zte.com.cn>
In a case, we have an not enabled VQ (virtio-net) which desc is NULL
and get a last_avail_idx is not 0 from dpdk.
As a result, it is successed to create a snapshot, but failed to revert it.
Because in virtio_load(), there is an inconsistent check for VQ.
(call virtio_load() in revert, and virtio_save() in create.)
Correspondly, in virtio_save() should also do this check to find the error
as early as possible.
Signed-off-by: Cheng Lin <cheng.lin130@zte.com.cn>
---
hw/virtio/virtio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 2e91dec..eadbf64 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2792,6 +2792,12 @@ int virtio_save(VirtIODevice *vdev, QEMUFile *f)
* Save desc now, the rest of the ring addresses are saved in
* subsections for VIRTIO-1 devices.
*/
+ if (!vdev->vq[i].vring.desc && vdev->vq[i].last_avail_idx) {
+ error_report("VQ %d address 0x0 "
+ "inconsistent with Host index 0x%x",
+ i, vdev->vq[i].last_avail_idx);
+ return -1;
+ }
qemu_put_be64(f, vdev->vq[i].vring.desc);
qemu_put_be16s(f, &vdev->vq[i].last_avail_idx);
if (k->save_queue) {
--
2.7.2.windows.1
reply other threads:[~2019-10-30 8:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1572422987-19683-1-git-send-email-wang.yi59@zte.com.cn \
--to=wang.yi59@zte.com.cn \
--cc=cheng.lin130@zte.com.cn \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=wang.liang82@zte.com.cn \
--cc=xue.zhihong@zte.com.cn \
/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).