All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vhost-user-blk: fix the resize crash
@ 2022-09-19 12:18 Li Feng
  2022-09-21  2:51 ` Raphael Norwitz
  2022-10-21  9:54 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Li Feng @ 2022-09-19 12:18 UTC (permalink / raw)
  To: Michael S. Tsirkin, Raphael Norwitz, Kevin Wolf, Hanna Reitz,
	open list:Block layer core, open list:All patches CC here
  Cc: lifeng1519, Li Feng

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>
---
 hw/block/vhost-user-blk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c
index 9117222456..db30bb754f 100644
--- a/hw/block/vhost-user-blk.c
+++ b/hw/block/vhost-user-blk.c
@@ -95,6 +95,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,
                                sizeof(struct virtio_blk_config),
                                &local_err);
-- 
2.37.3



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost-user-blk: fix the resize crash
  2022-09-19 12:18 [PATCH] vhost-user-blk: fix the resize crash Li Feng
@ 2022-09-21  2:51 ` Raphael Norwitz
  2022-10-21  9:54 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Raphael Norwitz @ 2022-09-21  2:51 UTC (permalink / raw)
  To: Li Feng, Michael S. Tsirkin, Kevin Wolf, Hanna Reitz,
	open list:Block layer core, open list:All patches CC here
  Cc: lifeng1519@gmail.com, Li Feng

[-- Attachment #1: Type: text/plain, Size: 1127 bytes --]

>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<mailto:fengli@smartx.com>



Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>



>---

> hw/block/vhost-user-blk.c | 4 ++++

> 1 file changed, 4 insertions(+)

>

>diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c

>index 9117222456..db30bb754f 100644

>--- a/hw/block/vhost-user-blk.c

>+++ b/hw/block/vhost-user-blk.c

>@@ -95,6 +95,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,

>                                sizeof(struct virtio_blk_config),

>                                &local_err);

>--

>2.37.3

>


[-- Attachment #2: Type: text/html, Size: 5039 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] vhost-user-blk: fix the resize crash
  2022-09-19 12:18 [PATCH] vhost-user-blk: fix the resize crash Li Feng
  2022-09-21  2:51 ` Raphael Norwitz
@ 2022-10-21  9:54 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2022-10-21  9:54 UTC (permalink / raw)
  To: Li Feng
  Cc: Michael S. Tsirkin, Raphael Norwitz, Hanna Reitz,
	open list:Block layer core, open list:All patches CC here,
	lifeng1519

Am 19.09.2022 um 14:18 hat Li Feng geschrieben:
> 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>

Thanks, applied to the block branch.

Kevin



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-21 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-19 12:18 [PATCH] vhost-user-blk: fix the resize crash Li Feng
2022-09-21  2:51 ` Raphael Norwitz
2022-10-21  9:54 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.