net/virtio: fix repeated freeing of virtqueue
authorGaoxiang Liu <liugaoxiang@huawei.com>
Tue, 31 Aug 2021 14:39:51 +0000 (22:39 +0800)
committerMaxime Coquelin <maxime.coquelin@redhat.com>
Tue, 14 Sep 2021 11:21:57 +0000 (13:21 +0200)
When virtio_init_queue returns error, the memory of vq is freed.
But the value of hw->vqs[queue_idx] does not restore.
If virtio_init_queue returns error, the memory of vq is freed again
in virtio_free_queues.

Fixes: 69c80d4ef89b ("net/virtio: allocate queue at init stage")
Cc: stable@dpdk.org
Signed-off-by: Gaoxiang Liu <liugaoxiang@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
drivers/net/virtio/virtio_ethdev.c

index 061d02f..51fa85b 100644 (file)
@@ -632,6 +632,7 @@ free_mz:
        rte_memzone_free(mz);
 free_vq:
        rte_free(vq);
+       hw->vqs[queue_idx] = NULL;
 
        return ret;
 }