net/idpf: cancel alarm when fail to init adapter
PATCH 1/1 net/idpf: cancel alarm when fail to init adapter
From: Beilei Xing <[email protected]>
Cancel alarm if failing to allocate vports memory during adapter_ext initialization. Otherwise, there'll be segmentation fault when fail to initialize adapter_ext.
--- drivers/net/idpf/idpf_ethdev.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/idpf/idpf_ethdev.c +1 -0
@@ -1172,6 +1172,7 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *areturn ret; err_get_ptype: +rte_eal_alarm_cancel (idpf_dev_alarm_handler, adapter);idpf_adapter_deinit (base); err_adapter_init:return ret;
Signature · 1 line
2.26.2
PATCH v2 1/1 net/idpf: cancel alarm when fail to init adapter
From: Beilei Xing <[email protected]>
Cancel alarm if failing to allocate vports memory during adapter_ext initialization. Otherwise, there'll be segmentation fault when fail to initialize adapter_ext.
---
v2 change:
- Refine error code.
drivers/net/idpf/idpf_ethdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/idpf/idpf_ethdev.c +3 -2
@@ -1161,7 +1161,7 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *aif (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 *areturn 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;
Signature · 1 line
2.26.2
Quoted 11 lines
-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, March 20, 2023 3:12 PM
To: Wu, Jingjing <[email protected]>
Cc: [email protected]; Xing, Beilei <[email protected]>; [email protected]
Subject: [PATCH v2] net/idpf: cancel alarm when fail to init adapterFrom: Beilei Xing <[email protected]>
Quoted 8 lines
Cancel alarm if failing to allocate vports memory during
adapter_extinitialization. Otherwise, there'll be segmentation fault when fail to initializeadapter_ext.Fixes b2f9d4788d5c ("common/idpf: introduce adapter init/deinit")Signed-off-by Beilei Xing <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi