DPDK patches and discussions
 help / color / mirror / Atom feed
From: beilei.xing@intel.com
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, Beilei Xing <beilei.xing@intel.com>, stable@dpdk.org
Subject: [PATCH v2] net/idpf: cancel alarm when fail to init adapter
Date: Mon, 20 Mar 2023 07:12:19 +0000	[thread overview]
Message-ID: <20230320071219.83383-1-beilei.xing@intel.com> (raw)
In-Reply-To: <20230320070622.28776-1-beilei.xing@intel.com>

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


  reply	other threads:[~2023-03-20  7:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20  7:06 [PATCH] " beilei.xing
2023-03-20  7:12 ` beilei.xing [this message]
2023-03-21 10:30   ` [PATCH v2] " Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230320071219.83383-1-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).