ethdev: fix port accessing after release
authorMatan Azrad <matan@mellanox.com>
Wed, 28 Mar 2018 12:10:30 +0000 (12:10 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 30 Mar 2018 12:08:44 +0000 (14:08 +0200)
commitf0e1180cb6a99825587ce4c108c4366023ac1f63
tree6af9fad6b5d6e58b8f0108e558c319a9218d6d35
parentc152cbe2522afa12e49bdc4bb19eb5adc6227218
ethdev: fix port accessing after release

rte_eth_dev_pci_release() function wrongly releases an ethdev port and
then releases internal fields of this port.
This behavior is problematic, because after the release, the port may
be reallocated again by another thread or just be invalid for any
usage.

Move the release operation to the end of the function.

Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")
Cc: stable@dpdk.org
Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_ether/rte_ethdev_pci.h