[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.14] net: use peer when purging queue in qemu_flush_or_purge_queue_packets()



commit 521898ac31a76c930bf8f213d8cdb0233da7a9ff
Author:     Jason Wang <jasowang@xxxxxxxxxx>
AuthorDate: Mon May 11 12:04:53 2020 +0800
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Mon Aug 24 21:03:02 2020 -0500

    net: use peer when purging queue in qemu_flush_or_purge_queue_packets()
    
    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:
    
    hw/net/virtio-net.c:533: void virtio_net_reset(VirtIODevice *): Assertion
    `!virtio_net_get_subqueue(nc)->async_tx.elem' failed.
    #9 0x55a33fa31b78 in virtio_net_reset hw/net/virtio-net.c:533:13
    #10 0x55a33fc88412 in virtio_reset hw/virtio/virtio.c:1919:9
    #11 0x55a341d82764 in virtio_bus_reset hw/virtio/virtio-bus.c:95:9
    #12 0x55a341dba2de in virtio_pci_reset hw/virtio/virtio-pci.c:1824:5
    #13 0x55a341db3e02 in virtio_pci_common_write hw/virtio/virtio-pci.c:1252:13
    #14 0x55a33f62117b in memory_region_write_accessor memory.c:496:5
    #15 0x55a33f6205e4 in access_with_adjusted_size memory.c:557:18
    #16 0x55a33f61e177 in memory_region_dispatch_write memory.c:1488:16
    
    Reproducer:
    https://www.mail-archive.com/qemu-devel@xxxxxxxxxx/msg701914.html
    
    Fix by using the peer.
    
    Reported-by: "Alexander Bulekov" <alxndr@xxxxxx>
    Acked-by: Alexander Bulekov <alxndr@xxxxxx>
    Fixes: ca77d85e1dbf9 ("net: complete all queued packets on VM stop")
    Cc: qemu-stable@xxxxxxxxxx
    Signed-off-by: Jason Wang <jasowang@xxxxxxxxxx>
    (cherry picked from commit 5fe19fb81839ea42b592b409f725349cf3c73551)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 net/net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/net.c b/net/net.c
index cbeeeadff8..4c62b10acd 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);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.14



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.