net/ice: fix segment fault

Message ID 20190130082346.18669-1-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ice: fix segment fault |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Qi Zhang Jan. 30, 2019, 8:23 a.m. UTC
  Fix segment fault when detach a device due to some redundant function
call in ice_dev_uninit.

Fixes: f9cf4f864150 ("net/ice: support device initialization")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Comments

Wenzhuo Lu Feb. 1, 2019, 1:35 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Zhang, Qi Z
> Sent: Wednesday, January 30, 2019 4:24 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/ice: fix segment fault
> 
> Fix segment fault when detach a device due to some redundant function call
> in ice_dev_uninit.
> 
> Fixes: f9cf4f864150 ("net/ice: support device initialization")
> 
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
  
Qi Zhang Feb. 13, 2019, 3:26 a.m. UTC | #2
> -----Original Message-----
> From: Lu, Wenzhuo
> Sent: Friday, February 1, 2019 9:36 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming <qiming.yang@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] net/ice: fix segment fault
> 
> Hi,
> 
> > -----Original Message-----
> > From: Zhang, Qi Z
> > Sent: Wednesday, January 30, 2019 4:24 PM
> > To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>
> > Cc: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH] net/ice: fix segment fault
> >
> > Fix segment fault when detach a device due to some redundant function
> > call in ice_dev_uninit.
> >
> > Fixes: f9cf4f864150 ("net/ice: support device initialization")
> >
> > Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 6ab66faeb..6b0113b37 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1458,15 +1458,14 @@  ice_dev_close(struct rte_eth_dev *dev)
 
 	ice_res_pool_destroy(&pf->msix_pool);
 	ice_release_vsi(pf->main_vsi);
-
+	ice_sched_cleanup_all(hw);
+	rte_free(hw->port_info);
 	ice_shutdown_all_ctrlq(hw);
 }
 
 static int
 ice_dev_uninit(struct rte_eth_dev *dev)
 {
-	struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
@@ -1486,11 +1485,6 @@  ice_dev_uninit(struct rte_eth_dev *dev)
 	rte_intr_callback_unregister(intr_handle,
 				     ice_interrupt_handler, dev);
 
-	ice_release_vsi(pf->main_vsi);
-	ice_sched_cleanup_all(hw);
-	rte_free(hw->port_info);
-	ice_shutdown_all_ctrlq(hw);
-
 	return 0;
 }