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 <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-05-11 22:15:02 +02:00
committed by Rob Bradford
parent 9a46affc33
commit 534aaaceb2

View File

@@ -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> {