mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] misc: nsm: reset device before deleting the virtqueue on removal
@ 2026-10-16  3:02 Yuho Choi
  0 siblings, 0 replies; only message in thread
From: Yuho Choi @ 2026-10-16  3:02 UTC (permalink / raw)
  To: Alexander Graf, Arnd Bergmann, Greg Kroah-Hartman
  Cc: The AWS Nitro Enclaves Team, linux-kernel, Yuho Choi, stable

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@vger.kernel.org
Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-16  3:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16  3:02 [PATCH v1] misc: nsm: reset device before deleting the virtqueue on removal Yuho Choi

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®