]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio-net: Add only one queue pair when realizing
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Sun, 28 Apr 2024 07:00:51 +0000 (16:00 +0900)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 29 Aug 2025 15:05:04 +0000 (18:05 +0300)
Multiqueue usage is not negotiated yet when realizing. If more than
one queue is added and the guest never requests to enable multiqueue,
the extra queues will not be deleted when unrealizing and leak.

Fixes: f9d6dbf0bf6e ("virtio-net: remove virtio queues if the guest doesn't support multiqueue")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
(cherry picked from commit 8c49756825dab430b17648637735c2736d23f778)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/net/virtio-net.c

index 0ba1db5b142c3dd4c60cfa46dd5114989756d9ba..d7d155a44d44a7d367832164a7db2847dadc4dea 100644 (file)
@@ -3640,9 +3640,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
     n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n),
                                     n->net_conf.tx_queue_size);
 
-    for (i = 0; i < n->max_queue_pairs; i++) {
-        virtio_net_add_queue(n, i);
-    }
+    virtio_net_add_queue(n, 0);
 
     n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl);
     qemu_macaddr_default_if_unset(&n->nic_conf.macaddr);