[PATCH v1] misc: nsm: reset device before deleting the virtqueue on removal
From: Yuho Choi
Date: Thu Oct 15 2026 - 23:02:47 EST
nsm_device_remove() deletes the virtqueue without resetting the device
first. del_vqs() frees the vring backing, but does not provide a generic
device quiesce operation. In particular, modern virtio-pci keeps enabled
queues active until the device is reset, so the device can still access
the vring memory after it has been released.
It also leaves the device status at DRIVER_OK, so unbinding the driver
trips the WARN_ON_ONCE() in virtio_dev_remove() that checks the driver
has reset the device.
Reset the device before deleting the virtqueue.
Fixes: b9873755a6c8 ("misc: Add Nitro Secure Module driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Yuho Choi <oss.patchbox@xxxxxxxxx>
---
drivers/misc/nsm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/nsm.c b/drivers/misc/nsm.c
index a3a9f9bfc6b7..7193dfc4343b 100644
--- a/drivers/misc/nsm.c
+++ b/drivers/misc/nsm.c
@@ -483,6 +483,7 @@ static void nsm_device_remove(struct virtio_device *vdev)
hwrng_unregister(&nsm->hwrng);
+ virtio_reset_device(vdev);
vdev->config->del_vqs(vdev);
misc_deregister(&nsm->misc);
}
base-commit: 2f2f7eeef8b0a1a9b9ca998231419873ccae8d4e
--
2.43.0