On 200511 1204, Jason Wang wrote:
> 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" <alx...@bu.edu>
> Fixes: ca77d85e1dbf9 ("net: complete all queued packets on VM stop")
> Cc: qemu-sta...@nongnu.org
> Signed-off-by: Jason Wang <jasow...@redhat.com>

Hi Jason,
With this patch, I can no longer reproduce the crash

Acked-by: Alexander Bulekov <alx...@bu.edu>

Thanks!

> ---
>  net/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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);
>      }
>  }
>  
> -- 
> 2.20.1
> 

Reply via email to