From c1b26b1fab449d9f8d841a5077e6525caabf1b0c Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 17 Sep 2019 07:43:22 -0700 Subject: [PATCH] vhost_user_backend: Don't process disabled queues Every time an event is triggered, it needs to be read, but only based on the status of the vring (enabled or not) will decide if the queue needs to be processed. Signed-off-by: Sebastien Boeuf --- vhost_user_backend/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index 883ca811a..c43c5ea1b 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -329,6 +329,12 @@ impl VringEpollHandler { .map_err(VringEpollHandlerError::HandleEventReadKick)?; } + // If the vring is not enabled, it should not be processed. + // The event is only read to be discarded. + if !self.vrings[device_event as usize].read().unwrap().enabled { + return Ok(false); + } + self.process_queue(device_event)?; Ok(false) }