Skip to contentSkip to conversation

net/virtio-user: fix crash when detaching device

PATCH Applied Allain Legacy 2 participants 2 messages Jun 23, 2017 – Jul 4, 2017 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/virtio-user: fix crash when detaching device

The rte_eth_dev.data pointer is set to a reference to a static table. Attempting to rte_free() it leads to a panic. For example, the following commands result in a panic if run in testpmd

testpmd> port attach virtio_user0,path=/dev/vhost-net,iface=test0 testpmd> port stop 2
testpmd> port close 2
testpmd> port detach 2

Fixes ce2eabdd43ec ("net/virtio-user: add virtual device")
---
 drivers/net/virtio/virtio_user_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/virtio/virtio_user_ethdev.c +0 -1
index 280406c02..e9af946e8 100644
@@ -556,7 +556,6 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)
 	virtio_user_dev_uninit(dev);
 
 	rte_free(eth_dev->data->dev_private);
-	rte_free(eth_dev->data);
 	rte_eth_dev_release_port(eth_dev);
 
 	return 0;
Signature · 1 line
2.12.1
Applied
#1 lore raw
Quoted 10 lines · Allain Legacy

The rte_eth_dev.data pointer is set to a reference to a static table. Attempting to rte_free() it leads to a panic. For example, the following commands result in a panic if run in testpmd

testpmd> port attach virtio_user0,path=/dev/vhost-net,iface=test0 testpmd> port stop 2
testpmd> port close 2
testpmd> port detach 2

Fixes ce2eabdd43ec ("net/virtio-user: add virtual device")

Note that it's prefered (and asked) to add stable tag inside the commit log.

Applied to dpdk-next-virtio, with above tag added.

Thanks.

	--yliu