* [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK
@ 2026-09-22 21:11 Yuho Choi
2026-10-01 20:29 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Yuho Choi @ 2026-09-22 21:11 UTC (permalink / raw)
To: Michael S . Tsirkin, Jason Wang, Jens Axboe
Cc: Stefan Hajnoczi, Paolo Bonzini, Eugenio Pérez, Xuan Zhuo,
virtualization, linux-block, linux-kernel, stable, Yuho Choi
virtblk_probe() marks the device ready before revalidating zones and
adding the disk, and either of those can fail. The out_cleanup_disk path
they take goes on to delete the virtqueues, but nothing tells the device
to stop first, so it is still live when the rings are freed.
Reset the device at out_cleanup_disk, which is only reachable after
virtio_device_ready(). virtblk_remove() and virtblk_freeze_priv() both
reset before deleting the virtqueues for the same reason.
Fixes: dbb301f91fc8 ("virtio_blk: add error handling support for add_disk()")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
drivers/block/virtio_blk.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 32bf3ba07a9dc..ed97dafebe164 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -1547,6 +1547,7 @@ static int virtblk_probe(struct virtio_device *vdev)
return 0;
out_cleanup_disk:
+ virtio_reset_device(vdev);
put_disk(vblk->disk);
out_free_tags:
blk_mq_free_tag_set(&vblk->tag_set);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK
2026-09-22 21:11 [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK Yuho Choi
@ 2026-10-01 20:29 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2026-10-01 20:29 UTC (permalink / raw)
To: Yuho Choi
Cc: Michael S . Tsirkin, Jason Wang, Jens Axboe, Paolo Bonzini,
Eugenio Pérez, Xuan Zhuo, virtualization, linux-block,
linux-kernel, stable, Jean-Philippe Brucker, Marcel Holtmann
On Tue, Sep 22, 2026 at 05:11:41PM -0400, Yuho Choi wrote:
> virtblk_probe() marks the device ready before revalidating zones and
> adding the disk, and either of those can fail. The out_cleanup_disk path
> they take goes on to delete the virtqueues, but nothing tells the device
> to stop first, so it is still live when the rings are freed.
>
> Reset the device at out_cleanup_disk, which is only reachable after
> virtio_device_ready(). virtblk_remove() and virtblk_freeze_priv() both
> reset before deleting the virtqueues for the same reason.
>
> Fixes: dbb301f91fc8 ("virtio_blk: add error handling support for add_disk()")
> Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
> ---
> drivers/block/virtio_blk.c | 1 +
> 1 file changed, 1 insertion(+)
Thanks for the fix!
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
>
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 32bf3ba07a9dc..ed97dafebe164 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -1547,6 +1547,7 @@ static int virtblk_probe(struct virtio_device *vdev)
> return 0;
>
> out_cleanup_disk:
> + virtio_reset_device(vdev);
> put_disk(vblk->disk);
> out_free_tags:
> blk_mq_free_tag_set(&vblk->tag_set);
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-01 20:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 21:11 [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK Yuho Choi
2026-10-01 20:29 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®