mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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>
This commit is contained in:
parent
7845e73147
commit
ab6075d849
1 changed files with 4 additions and 0 deletions
|
@ -97,6 +97,10 @@ static int vhost_user_blk_handle_config_change(struct vhost_dev *dev)
|
||||||
VHostUserBlk *s = VHOST_USER_BLK(dev->vdev);
|
VHostUserBlk *s = VHOST_USER_BLK(dev->vdev);
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
|
|
||||||
|
if (!dev->started) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = vhost_dev_get_config(dev, (uint8_t *)&blkcfg,
|
ret = vhost_dev_get_config(dev, (uint8_t *)&blkcfg,
|
||||||
vdev->config_len, &local_err);
|
vdev->config_len, &local_err);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue