DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: fix missing NULL point check
@ 2018-07-02  4:18 Qi Zhang
  2018-07-12  9:36 ` Remy Horton
  0 siblings, 1 reply; 2+ messages in thread
From: Qi Zhang @ 2018-07-02  4:18 UTC (permalink / raw)
  To: remy.horton; +Cc: wenzhuo.lu, dev, Qi Zhang, stable

Add missing NULL point check in ixgbe_pf_host_uninit, or it may cause
segement fault when detach a device. 

Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ixgbe/ixgbe_pf.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4d199c8..73f0e43 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -128,21 +128,24 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
-
 	RTE_ETH_DEV_SRIOV(eth_dev).active = 0;
 	RTE_ETH_DEV_SRIOV(eth_dev).nb_q_per_pool = 0;
 	RTE_ETH_DEV_SRIOV(eth_dev).def_vmdq_idx = 0;
 	RTE_ETH_DEV_SRIOV(eth_dev).def_pool_q_idx = 0;
 
-	ret = rte_eth_switch_domain_free((*vfinfo)->switch_domain_id);
-	if (ret)
-		PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
-
 	vf_num = dev_num_vf(eth_dev);
 	if (vf_num == 0)
 		return;
 
+	vfinfo = IXGBE_DEV_PRIVATE_TO_P_VFDATA(eth_dev->data->dev_private);
+
+	if (*vfinfo == NULL)
+		return;
+
+	ret = rte_eth_switch_domain_free((*vfinfo)->switch_domain_id);
+	if (ret)
+		PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
+
 	rte_free(*vfinfo);
 	*vfinfo = NULL;
 }
-- 
2.5.5

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix missing NULL point check
  2018-07-02  4:18 [dpdk-dev] [PATCH] net/ixgbe: fix missing NULL point check Qi Zhang
@ 2018-07-12  9:36 ` Remy Horton
  0 siblings, 0 replies; 2+ messages in thread
From: Remy Horton @ 2018-07-12  9:36 UTC (permalink / raw)
  To: Qi Zhang; +Cc: wenzhuo.lu, dev, stable

Patch doesn't apply to latest master, but otherwise seems fine to me.

On 02/07/2018 05:18, Qi Zhang wrote:
> Add missing NULL point check in ixgbe_pf_host_uninit, or it may cause
> segement fault when detach a device.
>
> Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
> Cc: stable@dpdk.org
>
> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-12  9:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02  4:18 [dpdk-dev] [PATCH] net/ixgbe: fix missing NULL point check Qi Zhang
2018-07-12  9:36 ` Remy Horton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).