DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/idpf: cancel alarm when fail to init adapter
@ 2023-03-20  7:06 beilei.xing
  2023-03-20  7:12 ` [PATCH v2] " beilei.xing
  0 siblings, 1 reply; 3+ messages in thread
From: beilei.xing @ 2023-03-20  7:06 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Cancel alarm if failing to allocate vports memory during adapter_ext
initialization. Otherwise, there'll be segmentation fault when fail
to initialize adapter_ext.

Fixes: b2f9d4788d5c ("common/idpf: introduce adapter init/deinit")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 drivers/net/idpf/idpf_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 46aec6ae37..d8b5bc3e39 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -1172,6 +1172,7 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
 	return ret;
 
 err_get_ptype:
+	rte_eal_alarm_cancel(idpf_dev_alarm_handler, adapter);
 	idpf_adapter_deinit(base);
 err_adapter_init:
 	return ret;
-- 
2.26.2


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

* [PATCH v2] net/idpf: cancel alarm when fail to init adapter
  2023-03-20  7:06 [PATCH] net/idpf: cancel alarm when fail to init adapter beilei.xing
@ 2023-03-20  7:12 ` beilei.xing
  2023-03-21 10:30   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: beilei.xing @ 2023-03-20  7:12 UTC (permalink / raw)
  To: jingjing.wu; +Cc: dev, Beilei Xing, stable

From: Beilei Xing <beilei.xing@intel.com>

Cancel alarm if failing to allocate vports memory during adapter_ext
initialization. Otherwise, there'll be segmentation fault when fail
to initialize adapter_ext.

Fixes: b2f9d4788d5c ("common/idpf: introduce adapter init/deinit")
Cc: stable@dpdk.org

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---

v2 change:
 - Refine error code.

 drivers/net/idpf/idpf_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 46aec6ae37..e02ec2ec5a 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -1161,7 +1161,7 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
 	if (adapter->vports == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate vports memory");
 		ret = -ENOMEM;
-		goto err_get_ptype;
+		goto err_vports_alloc;
 	}
 
 	adapter->cur_vports = 0;
@@ -1171,7 +1171,8 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a
 
 	return ret;
 
-err_get_ptype:
+err_vports_alloc:
+	rte_eal_alarm_cancel(idpf_dev_alarm_handler, adapter);
 	idpf_adapter_deinit(base);
 err_adapter_init:
 	return ret;
-- 
2.26.2


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

* RE: [PATCH v2] net/idpf: cancel alarm when fail to init adapter
  2023-03-20  7:12 ` [PATCH v2] " beilei.xing
@ 2023-03-21 10:30   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2023-03-21 10:30 UTC (permalink / raw)
  To: Xing, Beilei, Wu, Jingjing; +Cc: dev, Xing, Beilei, stable



> -----Original Message-----
> From: beilei.xing@intel.com <beilei.xing@intel.com>
> Sent: Monday, March 20, 2023 3:12 PM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; Xing, Beilei <beilei.xing@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/idpf: cancel alarm when fail to init adapter
> 
> From: Beilei Xing <beilei.xing@intel.com>
> 
> Cancel alarm if failing to allocate vports memory during adapter_ext
> initialization. Otherwise, there'll be segmentation fault when fail to initialize
> adapter_ext.
> 
> Fixes: b2f9d4788d5c ("common/idpf: introduce adapter init/deinit")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Beilei Xing <beilei.xing@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


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

end of thread, other threads:[~2023-03-21 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20  7:06 [PATCH] net/idpf: cancel alarm when fail to init adapter beilei.xing
2023-03-20  7:12 ` [PATCH v2] " beilei.xing
2023-03-21 10:30   ` 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).