virtio-net: fix the upper bound when trying to delete queues
authorJason Wang <jasowang@redhat.com>
Thu, 23 Apr 2015 06:21:34 +0000 (14:21 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 27 Apr 2015 18:49:45 +0000 (20:49 +0200)
Virtqueue were indexed from zero, so don't delete virtqueue whose
index is n->max_queues * 2 + 1.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-stable <qemu-stable@nongnu.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/net/virtio-net.c

index 59f76bc..b6fac9c 100644 (file)
@@ -1309,7 +1309,7 @@ static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue)
 
     n->multiqueue = multiqueue;
 
-    for (i = 2; i <= n->max_queues * 2 + 1; i++) {
+    for (i = 2; i < n->max_queues * 2 + 1; i++) {
         virtio_del_queue(vdev, i);
     }