diff mbox series

net: use peer when purging queue in qemu_flush_or_purge_queue_packets()

Message ID 20200511040453.23956-1-jasowang@redhat.com
State New
Headers show
Series net: use peer when purging queue in qemu_flush_or_purge_queue_packets() | expand

Commit Message

Jason Wang May 11, 2020, 4:04 a.m. UTC
The sender of packet will be checked in the qemu_net_queue_purge() but
we use NetClientState not its peer when trying to purge the incoming
queue in qemu_flush_or_purge_packets(). This will trigger the assert
in virtio_net_reset since we can't pass the sender check.

Fix by using the peer.

Reported-by: "Alexander Bulekov" <alxndr@bu.edu>
Fixes: ca77d85e1dbf9 ("net: complete all queued packets on VM stop")
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/net/net.c b/net/net.c
index 38778e831d..9e47cf727d 100644
--- a/net/net.c
+++ b/net/net.c
@@ -610,7 +610,7 @@  void qemu_flush_or_purge_queued_packets(NetClientState *nc, bool purge)
         qemu_notify_event();
     } else if (purge) {
         /* Unable to empty the queue, purge remaining packets */
-        qemu_net_queue_purge(nc->incoming_queue, nc);
+        qemu_net_queue_purge(nc->incoming_queue, nc->peer);
     }
 }