From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71966427E0; Mon, 20 Mar 2023 08:44:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C77640A80; Mon, 20 Mar 2023 08:44:33 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id B3FD0406BC; Mon, 20 Mar 2023 08:44:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679298271; x=1710834271; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EBnyKENJxMfXDL8/yuGLXU3TRJDrH5SnoOsZp9AJxDo=; b=L8fXd1h8e0m+R8WoMGh/MolYlO3Ys3JqLfKTZs4i92g6rCpMfLv+TRB1 OD5w8358tHvr5IR/uod0fzz5dZjM0Q+kUfv0qyTgEVETgWDPPzTkEg9Ia wRbWrsBrZHfNVB49aDVlU1mDyS82ZZrFqi7H7jF6Se4sFdIsDxDCtOwJj 1mus974E3H1DVS8uZRboazM82Y0xURsY3ahhUMbZCasxNY6WpsAbxkqNY +N2hv3V0uRHBpiNRBK0EV82T/k6R7/4sY7AHLsd1hv6AiLKXm5NzC1UTl 89Ng5G69XCfueV4Zb8xUbEdI8THeX0n8InaB26UGKPSssrCthZflrO1l/ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="424872861" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="424872861" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2023 00:44:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10654"; a="1010372751" X-IronPort-AV: E=Sophos;i="5.98,274,1673942400"; d="scan'208";a="1010372751" Received: from dpdk-beileix-3.sh.intel.com ([10.67.110.253]) by fmsmga005.fm.intel.com with ESMTP; 20 Mar 2023 00:44:26 -0700 From: beilei.xing@intel.com To: jingjing.wu@intel.com Cc: dev@dpdk.org, Beilei Xing , stable@dpdk.org Subject: [PATCH v2] net/idpf: cancel alarm when fail to init adapter Date: Mon, 20 Mar 2023 07:12:19 +0000 Message-Id: <20230320071219.83383-1-beilei.xing@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20230320070622.28776-1-beilei.xing@intel.com> References: <20230320070622.28776-1-beilei.xing@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Beilei Xing 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 --- 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