net: use peer when purging queue in qemu_flush_or_purge_queue_packets()
PATCH 1/1 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.
Fix by using the peer.
--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/net.c +1 -1
@@ -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); } }
Signature · 1 line
2.20.1
Quoted 11 lines · Jason Wang
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 inqemu_flush_or_purge_packets(). This will trigger the assert invirtio_net_resetsince we can't pass the sender check.Fix by using the peer.
Reported-by "Alexander Bulekov" <[email protected]>Fixes ca77d85e1dbf9 ("net: complete all queued packets on VM stop")Signed-off-by Jason Wang <[email protected]>
Hi Jason,
With this patch, I can no longer reproduce the crash
Thanks!
Quoted 20 lines
--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +1
-1@@ -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); } }Signature · 1 line
2.20.1
Jason Wang
AppliedQuoted 12 lines · Alexander Bulekov
Quoted 11 lines · Jason Wang
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 inqemu_flush_or_purge_packets(). This will trigger the assert invirtio_net_resetsince we can't pass the sender check.Fix by using the peer.
Reported-by "Alexander Bulekov" <[email protected]>Fixes ca77d85e1dbf9 ("net: complete all queued packets on VM stop")Signed-off-by Jason Wang <[email protected]>
Quoted 6 lines
Hi Jason,
With this patch, I can no longer reproduce the crashThanks!
Applied.
Thanks
Quoted 21 lines
Quoted 21 lines
--- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +1
-1@@ -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); } }Signature · 1 line
2.20.1
Hi Jason,
Quoted 8 lines · Jason Wang
Quoted 7 lines · Alexander Bulekov
Quoted 6 lines · Jason Wang
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 inqemu_flush_or_purge_packets(). This will trigger the assert invirtio_net_resetsince we can't pass the sender check.Fix by using the peer.
Can you please include the backtrace:
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
And link to reproducer:
https://www.mail-archive.com/[email protected]/msg701914.html
Thanks,
Phil.
(Alexander, this is an example of why launchpad bug reports are easier to refer in commit history).
Quoted 42 lines
Quoted 11 lines
Quoted 5 lines
Reported-by "Alexander Bulekov" <[email protected]>Fixes ca77d85e1dbf9 ("net: complete all queued packets on VM stop")Signed-off-by Jason Wang <[email protected]>Hi Jason,
With this patch, I can no longer reproduce the crashThanks!
Applied.
Thanks
Quoted 21 lines
Quoted 21 lines
---
net/net.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +1
-1@@ -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); } }Signature · 1 line
2.20.1
Quoted 25 lines · Philippe Mathieu-Daudé
Hi Jason,
Quoted 8 lines · Jason Wang
Quoted 7 lines · Alexander Bulekov
Quoted 6 lines · Jason Wang
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 inqemu_flush_or_purge_packets(). This will trigger the assert invirtio_net_resetsince we can't pass the sender check.Fix by using the peer.
Can you please include the backtrace:
hw/net/virtio-net.c:533: voidvirtio_net_reset(VirtIODevice *): Assertion `!virtio_net_get_subqueue(nc)->async_tx.elem' failed.
#90x55a33fa31b78invirtio_net_resethw/net/virtio-net.c:533:13#100x55a33fc88412invirtio_resethw/virtio/virtio.c:1919:9
#110x55a341d82764invirtio_bus_resethw/virtio/virtio-bus.c:95:9#120x55a341dba2deinvirtio_pci_resethw/virtio/virtio-pci.c:1824:5#130x55a341db3e02invirtio_pci_common_writehw/virtio/virtio-pci.c:1252:13#140x55a33f62117binmemory_region_write_accessormemory.c:496:5 #150x55a33f6205e4inaccess_with_adjusted_sizememory.c:557:18 #160x55a33f61e177inmemory_region_dispatch_writememory.c:1488:16
Quoted 4 lines
And link to reproducer:
https://www.mail-archive.com/[email protected]/msg701914.htmlThanks,
Done.
Thanks
Quoted 48 lines
Phil.
(Alexander, this is an example of why launchpad bug reports are easier to refer in commit history).
Quoted 42 lines
Quoted 11 lines
Quoted 5 lines
Reported-by "Alexander Bulekov" <[email protected]>Fixes ca77d85e1dbf9 ("net: complete all queued packets on VM stop")Signed-off-by Jason Wang <[email protected]>Hi Jason,
With this patch, I can no longer reproduce the crashThanks!
Applied.
Thanks
Quoted 21 lines
Quoted 21 lines
---
net/net.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)net/net.c +1
-1@@ -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); } }Signature · 1 line
2.20.1