* [PATCH] nvdimm: virtio_pmem: reset the device if nvdimm_bus_register() fails
@ 2026-12-03 5:07 Yuho Choi
0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-12-03 5:07 UTC (permalink / raw)
To: Pankaj Gupta, Dan Williams, Vishal Verma, Dave Jiang,
Alison Schofield
Cc: Ira Weiny, Michael S . Tsirkin, nvdimm, virtualization,
linux-kernel, Yuho Choi
init_vq() enables the request queue on the device. If
nvdimm_bus_register() then fails, probe deletes the queue without
resetting the device, so the queue stays enabled and the next probe of
the device fails in setup_vq() with -ENOENT. Reset the device before
deleting the queue, as the later error path and remove() do.
Fixes: 6e84200c0a29 ("virtio-pmem: Add virtio pmem driver")
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
I used an LLM to write and run the test below.
Tested on d06ce6f1eb5e in a QEMU/KVM guest with a virtio-pmem-pci device
and KASAN. A test-only module parameter made nvdimm_bus_register() fail
in the first probe; after clearing it, binding the driver again gave
(3 of 3 runs each):
without this patch:
virtio_pmem virtio0: failed to initialize virtio pmem vq's
virtio_pmem virtio0: probe with driver virtio_pmem failed with error -2
with this patch:
the bind succeeds and nd_pmem namespace0.0 is created
No KASAN reports in any run.
drivers/nvdimm/virtio_pmem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvdimm/virtio_pmem.c b/drivers/nvdimm/virtio_pmem.c
index 3e06ff34c4af..e2b7fe50d181 100644
--- a/drivers/nvdimm/virtio_pmem.c
+++ b/drivers/nvdimm/virtio_pmem.c
@@ -117,6 +117,7 @@ static int virtio_pmem_probe(struct virtio_device *vdev)
if (!vpmem->nvdimm_bus) {
dev_err(&vdev->dev, "failed to register device with nvdimm_bus\n");
err = -ENXIO;
+ virtio_reset_device(vdev);
goto out_vq;
}
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-03 5:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 5:07 [PATCH] nvdimm: virtio_pmem: reset the device if nvdimm_bus_register() fails Yuho Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox