From e4c3401a334a46175418b59bac41aa9a3191279f Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 8 Jan 2020 14:42:12 +0100 Subject: [PATCH] vm-virtio: Don't waste a descriptor if not filled In case the virtio descriptor is pulled out of the Queue iterator, it is important to fill it and tag it as used. This is already done from the successful code path, but in case there's an error during the filling, we should make sure to put the descriptor back in the list of available descriptors. This way, when the error occurs, we don't loose a descriptor, and it could be used later. Signed-off-by: Sebastien Boeuf --- vm-virtio/src/console.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/vm-virtio/src/console.rs b/vm-virtio/src/console.rs index b27e73e5e..3f55eda08 100755 --- a/vm-virtio/src/console.rs +++ b/vm-virtio/src/console.rs @@ -93,6 +93,7 @@ impl ConsoleEpollHandler { let source_slice = in_buffer.drain(..len as usize).collect::>(); if let Err(e) = mem.write_slice(&source_slice[..], avail_desc.addr) { error!("Failed to write slice: {:?}", e); + recv_queue.go_to_previous_position(); break; }