DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach
@ 2018-05-30  6:31 Pablo de Lara
  2018-05-30 14:48 ` Burakov, Anatoly
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pablo de Lara @ 2018-05-30  6:31 UTC (permalink / raw)
  To: wenzhuo.lu, konstantin.ananyev; +Cc: dev, Pablo de Lara

When detaching a port bound to ixgbe PMD, if the port
does not have any VFs, *vfinfo is not set and there is
a NULL dereference attempt, when calling
rte_eth_switch_domain_free(), which expects VFs to be used,
causing a segmentation fault.

Steps to reproduce:

./testpmd -- -i
testpmd> port stop all
testpmd> port close all
testpmd> port detach 0

Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")

Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 drivers/net/ixgbe/ixgbe_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4d199c802..c381acf44 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -135,14 +135,14 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
 	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;
 
+	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.13.6

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach
  2018-05-30  6:31 [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach Pablo de Lara
@ 2018-05-30 14:48 ` Burakov, Anatoly
  2018-05-30 15:21 ` Remy Horton
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Burakov, Anatoly @ 2018-05-30 14:48 UTC (permalink / raw)
  To: Pablo de Lara, wenzhuo.lu, konstantin.ananyev; +Cc: dev

On 30-May-18 7:31 AM, Pablo de Lara wrote:
> When detaching a port bound to ixgbe PMD, if the port
> does not have any VFs, *vfinfo is not set and there is
> a NULL dereference attempt, when calling
> rte_eth_switch_domain_free(), which expects VFs to be used,
> causing a segmentation fault.
> 
> Steps to reproduce:
> 
> ./testpmd -- -i
> testpmd> port stop all
> testpmd> port close all
> testpmd> port detach 0
> 
> Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
> 
> Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---

Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach
  2018-05-30  6:31 [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach Pablo de Lara
  2018-05-30 14:48 ` Burakov, Anatoly
@ 2018-05-30 15:21 ` Remy Horton
  2018-05-30 17:49   ` Ferruh Yigit
  2018-05-31  9:02 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  2018-05-31  9:53 ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  3 siblings, 1 reply; 7+ messages in thread
From: Remy Horton @ 2018-05-30 15:21 UTC (permalink / raw)
  To: Pablo de Lara, wenzhuo.lu, konstantin.ananyev; +Cc: dev


On 30/05/2018 07:31, Pablo de Lara wrote:
[..]
> Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Acked-by: Remy Horton <remy.horton@intel.com>

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach
  2018-05-30 15:21 ` Remy Horton
@ 2018-05-30 17:49   ` Ferruh Yigit
  0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2018-05-30 17:49 UTC (permalink / raw)
  To: Remy Horton, Pablo de Lara, wenzhuo.lu, konstantin.ananyev; +Cc: dev

On 5/30/2018 4:21 PM, Remy Horton wrote:
> 
> On 30/05/2018 07:31, Pablo de Lara wrote:
> [..]
>> Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> 
> Acked-by: Remy Horton <remy.horton@intel.com>

The fix was late for the release.

A patch to document issue as known issue for this release sent:
https://dpdk.org/dev/patchwork/patch/40520/

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

* [dpdk-dev] [PATCH v2] net/ixgbe: fix crash on detach
  2018-05-30  6:31 [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach Pablo de Lara
  2018-05-30 14:48 ` Burakov, Anatoly
  2018-05-30 15:21 ` Remy Horton
@ 2018-05-31  9:02 ` Pablo de Lara
  2018-05-31  9:53 ` [dpdk-dev] [PATCH v3] " Pablo de Lara
  3 siblings, 0 replies; 7+ messages in thread
From: Pablo de Lara @ 2018-05-31  9:02 UTC (permalink / raw)
  To: wenzhuo.lu, konstantin.ananyev; +Cc: dev, Pablo de Lara, stable

When detaching a port bound to ixgbe PMD, if the port
does not have any VFs, *vfinfo is not set and there is
a NULL dereference attempt, when calling
rte_eth_switch_domain_free(), which expects VFs to be used,
causing a segmentation fault.

Steps to reproduce:

./testpmd -- -i
testpmd> port stop all
testpmd> port close all
testpmd> port detach 0

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

Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---

v2:
- Cc stable as this fix is targetting code that was introduced in
  previous release

 drivers/net/ixgbe/ixgbe_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4d199c802..c381acf44 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -135,14 +135,14 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
 	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;
 
+	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.17.0

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

* [dpdk-dev] [PATCH v3] net/ixgbe: fix crash on detach
  2018-05-30  6:31 [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach Pablo de Lara
                   ` (2 preceding siblings ...)
  2018-05-31  9:02 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
@ 2018-05-31  9:53 ` Pablo de Lara
  2018-06-21 13:31   ` Zhang, Qi Z
  3 siblings, 1 reply; 7+ messages in thread
From: Pablo de Lara @ 2018-05-31  9:53 UTC (permalink / raw)
  To: wenzhuo.lu, konstantin.ananyev; +Cc: dev, Pablo de Lara, stable

When detaching a port bound to ixgbe PMD, if the port
does not have any VFs, *vfinfo is not set and there is
a NULL dereference attempt, when calling
rte_eth_switch_domain_free(), which expects VFs to be used,
causing a segmentation fault.

Steps to reproduce:

./testpmd -- -i
testpmd> port stop all
testpmd> port close all
testpmd> port detach 0

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

Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Remy Horton <remy.horton@intel.com>
---

Changes in v3:
- Added Bugzilla ID

Changes in v2:
- CC'd stable list

 drivers/net/ixgbe/ixgbe_pf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c
index 4d199c802..c381acf44 100644
--- a/drivers/net/ixgbe/ixgbe_pf.c
+++ b/drivers/net/ixgbe/ixgbe_pf.c
@@ -135,14 +135,14 @@ void ixgbe_pf_host_uninit(struct rte_eth_dev *eth_dev)
 	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;
 
+	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.17.0

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

* Re: [dpdk-dev] [PATCH v3] net/ixgbe: fix crash on detach
  2018-05-31  9:53 ` [dpdk-dev] [PATCH v3] " Pablo de Lara
@ 2018-06-21 13:31   ` Zhang, Qi Z
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang, Qi Z @ 2018-06-21 13:31 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, Lu, Wenzhuo, Ananyev, Konstantin
  Cc: dev, De Lara Guarch, Pablo, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Thursday, May 31, 2018 5:53 PM
> To: Lu, Wenzhuo <wenzhuo.lu@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v3] net/ixgbe: fix crash on detach
> 
> When detaching a port bound to ixgbe PMD, if the port does not have any VFs,
> *vfinfo is not set and there is a NULL dereference attempt, when calling
> rte_eth_switch_domain_free(), which expects VFs to be used, causing a
> segmentation fault.
> 
> Steps to reproduce:
> 
> ./testpmd -- -i
> testpmd> port stop all
> testpmd> port close all
> testpmd> port detach 0
> 
> Bugzilla ID: 57
> Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")
> Cc: stable@dpdk.org
> 
> Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Tested-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Acked-by: Remy Horton <remy.horton@intel.com>

Applied to dpdk-next-net-intel

Thanks!
Qi

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

end of thread, other threads:[~2018-06-21 13:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-30  6:31 [dpdk-dev] [PATCH] net/ixgbe: fix crash on detach Pablo de Lara
2018-05-30 14:48 ` Burakov, Anatoly
2018-05-30 15:21 ` Remy Horton
2018-05-30 17:49   ` Ferruh Yigit
2018-05-31  9:02 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2018-05-31  9:53 ` [dpdk-dev] [PATCH v3] " Pablo de Lara
2018-06-21 13:31   ` Zhang, Qi Z

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).