vhost: fix double-free with zero-copy
authorPatrick Fu <patrick.fu@intel.com>
Tue, 21 Jul 2020 12:10:57 +0000 (12:10 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Jul 2020 14:55:30 +0000 (16:55 +0200)
zmbufs should be set to NULL when getting freed to avoid double free on
the same buffer pointer

Fixes: b0a985d1f340 ("vhost: add dequeue zero copy")
Cc: stable@dpdk.org
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
lib/librte_vhost/vhost_user.c

index df0db8a..9ddeae3 100644 (file)
@@ -1934,6 +1934,7 @@ free_zmbufs(struct vhost_virtqueue *vq)
        drain_zmbuf_list(vq);
 
        rte_free(vq->zmbufs);
+       vq->zmbufs = NULL;
 }
 
 /*