diff --git a/crates/vsock/src/vhu_vsock_thread.rs b/crates/vsock/src/vhu_vsock_thread.rs index 08c10226c..37e50b7bf 100644 --- a/crates/vsock/src/vhu_vsock_thread.rs +++ b/crates/vsock/src/vhu_vsock_thread.rs @@ -607,13 +607,15 @@ impl VhostUserVsockThread { None => return Err(Error::NoMemoryConfigured), }; - while let Some(mut avail_desc) = vring - .get_mut() - .get_queue_mut() + let mut vring_mut = vring.get_mut(); + + let queue = vring_mut.get_queue_mut(); + + let mut queue_iter = queue .iter(atomic_mem.memory()) - .map_err(|_| Error::IterateQueue)? - .next() - { + .map_err(|_| Error::IterateQueue)?; + + while let Some(mut avail_desc) = queue_iter.next() { used_any = true; let mem = atomic_mem.clone().memory();