diff --git a/virtio-devices/src/device.rs b/virtio-devices/src/device.rs index fd52032a3..b70092f89 100644 --- a/virtio-devices/src/device.rs +++ b/virtio-devices/src/device.rs @@ -282,7 +282,6 @@ impl VirtioCommon { } // Wait for the worker thread to finish and return - #[cfg(fuzzing)] pub fn wait_for_epoll_threads(&mut self) { if let Some(mut threads) = self.epoll_threads.take() { for t in threads.drain(..) { diff --git a/virtio-devices/src/net.rs b/virtio-devices/src/net.rs index f43bfae7c..7ce6e0d85 100644 --- a/virtio-devices/src/net.rs +++ b/virtio-devices/src/net.rs @@ -631,6 +631,8 @@ impl Drop for Net { // Ignore the result because there is nothing we can do about it. let _ = kill_evt.write(1); } + // Needed to ensure all references to tap FDs are dropped (#4868) + self.common.wait_for_epoll_threads(); } }