[dpdk-stable] [PATCH] net/virtio: fix dangling pointer on failure

Aaron Conole aconole at redhat.com
Mon Apr 15 16:48:18 CEST 2019


When eth_virtio_dev_init() is cleaning up, it does not correctly set
the mac_addrs variable to NULL, which will lead to a double free.

Found during unit-test fixes.

Fixes: 43d18765c027 ("net/virtio: fix memory leak on failure")
Cc: stable at dpdk.org
Reported-by: Michael Santana <msantana at redhat.com>
Signed-off-by: Aaron Conole <aconole at redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 2272bb2e5..d25c08f0a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1862,6 +1862,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 
 out:
 	rte_free(eth_dev->data->mac_addrs);
+	eth_dev->data->mac_addrs = NULL;
 	return ret;
 }
 
-- 
2.19.1



More information about the stable mailing list