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: ce2eabdd43 ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org

Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
This commit is contained in:
Allain Legacy 2017-06-23 08:41:37 -04:00 committed by Yuanhan Liu
parent 2dfeebe265
commit 2a7b7d837f

View File

@ -556,7 +556,6 @@ virtio_user_pmd_remove(struct rte_vdev_device *vdev)
virtio_user_dev_uninit(dev); virtio_user_dev_uninit(dev);
rte_free(eth_dev->data->dev_private); rte_free(eth_dev->data->dev_private);
rte_free(eth_dev->data);
rte_eth_dev_release_port(eth_dev); rte_eth_dev_release_port(eth_dev);
return 0; return 0;