There's no reason for tap to run when VM is stopped.
If we let it, it confuses the bridge on TX
and corrupts DMA memory on RX.

Signed-off-by: Michael S. Tsirkin <m...@redhat.com>
---
 hw/vhost_net.c |    2 +-
 net/tap.c      |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index c068be1..7061d6c 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -139,7 +139,7 @@ int vhost_net_start(struct vhost_net *net,
     }
 
     net->vc->info->poll(net->vc, false);
-    qemu_set_fd_handler(net->backend, NULL, NULL, NULL);
+    qemu_set_fd_handler3(true, net->backend, NULL, NULL, NULL, NULL);
     file.fd = net->backend;
     for (file.index = 0; file.index < net->dev.nvqs; ++file.index) {
         r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
diff --git a/net/tap.c b/net/tap.c
index 4afb314..246ef01 100644
--- a/net/tap.c
+++ b/net/tap.c
@@ -71,7 +71,8 @@ static void tap_writable(void *opaque);
 
 static void tap_update_fd_handler(TAPState *s)
 {
-    qemu_set_fd_handler2(s->fd,
+    qemu_set_fd_handler3(true,
+                         s->fd,
                          s->read_poll  ? tap_can_send : NULL,
                          s->read_poll  ? tap_send     : NULL,
                          s->write_poll ? tap_writable : NULL,
-- 
1.7.3.2.91.g446ac

Reply via email to