Thread (3 messages) 3 messages, 3 authors, 16h ago

[PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK

HOTtoday

From: Yuho Choi <hidden>
Date: 2026-09-22 21:12:20
Also in: linux-block, lkml, stable
Subsystem: block layer, the rest, virtio block and scsi drivers, virtio core · Maintainers: Jens Axboe, Linus Torvalds, "Michael S. Tsirkin", Jason Wang, Eugenio Pérez

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help