qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v6 9/9] virtio-net: add peer_deleted check in virtio_net_hand


From: Jason Wang
Subject: Re: [PATCH v6 9/9] virtio-net: add peer_deleted check in virtio_net_handle_rx
Date: Tue, 27 Apr 2021 15:15:58 +0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.10.0


在 2021/4/27 上午11:39, Cindy Lu 写道:
During the test, We found this fuction will continue running
while the peer is deleted, this will case the crash. so add
check for this.


Please describe how the issue is reproduced and why qemu_flush_queued_packets() is not a better place to fix that.

Thanks



Signed-off-by: Cindy Lu <lulu@redhat.com>
---
  hw/net/virtio-net.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 43b912453a..1be3f8e76f 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1403,7 +1403,9 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, 
VirtQueue *vq)
  {
      VirtIONet *n = VIRTIO_NET(vdev);
      int queue_index = vq2q(virtio_get_queue_index(vq));
-
+    if (n->nic->peer_deleted) {
+        return;
+    }
      qemu_flush_queued_packets(qemu_get_subqueue(n->nic, queue_index));
  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]