From 534aaaceb2a87029ab52603b04af965ec1a64032 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 11 May 2026 22:15:02 +0200 Subject: [PATCH] virtio-devices: Require at least one ready queue for activation When a guest resets a device by writing status=0 and reinitializes without enabling queues before writing DRIVER_OK, the activation path would collect zero ready queues and treat that as a fatal error, killing the entire VMM process. The PCI transport now checks that at least one queue is ready before reporting that the device needs activation. This prevents a spurious activation attempt that would fatally fail when no queues are enabled. Signed-off-by: Anatol Belski --- virtio-devices/src/transport/pci_device.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virtio-devices/src/transport/pci_device.rs b/virtio-devices/src/transport/pci_device.rs index d535dbd3e..ac37c5893 100644 --- a/virtio-devices/src/transport/pci_device.rs +++ b/virtio-devices/src/transport/pci_device.rs @@ -829,7 +829,9 @@ impl VirtioPciDevice { } fn needs_activation(&self) -> bool { - !self.device_activated.load(Ordering::SeqCst) && self.is_driver_ready() + !self.device_activated.load(Ordering::SeqCst) + && self.is_driver_ready() + && self.queues.iter().any(|q| q.ready()) } pub fn dma_handler(&self) -> Option<&dyn ExternalDmaMapping> {