summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Feng2022-09-19 14:18:16 +0200
committerKevin Wolf2022-10-27 20:14:11 +0200
commitab6075d849f4285fc730d3ae6e17418d65d09998 (patch)
tree818c8d1ed4a5af3e0249e2f5aa8ffed06fc74dac
parentblock/io_uring: revert "Use io_uring_register_ring_fd() to skip fd operations" (diff)
downloadqemu-ab6075d849f4285fc730d3ae6e17418d65d09998.tar.gz
qemu-ab6075d849f4285fc730d3ae6e17418d65d09998.tar.xz
qemu-ab6075d849f4285fc730d3ae6e17418d65d09998.zip
vhost-user-blk: fix the resize crash
If the os is not installed and doesn't have the virtio guest driver, the vhost dev isn't started, so the dev->vdev is NULL. Reproduce: mount a Win 2019 iso, go into the install ui, then resize the virtio-blk device, qemu crash. Signed-off-by: Li Feng <fengli@smartx.com> Message-Id: <20220919121816.3252223-1-fengli@smartx.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--hw/block/vhost-user-blk.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 84902dde17..13bf5cc47a 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -97,6 +97,10 @@ static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
VHostUserBlk *s = VHOST_USER_BLK(dev->vdev);
Error *local_err = NULL;
+ if (!dev->started) {
+ return 0;
+ }
+
ret = vhost_dev_get_config(dev, (uint8_t *)&blkcfg,
vdev->config_len, &local_err);
if (ret < 0) {