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 F2FBCA0C4B for ; Tue, 31 Aug 2021 16:22:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D6186406A3; Tue, 31 Aug 2021 16:22:20 +0200 (CEST) Received: from mail-m973.mail.163.com (mail-m973.mail.163.com [123.126.97.3]) by mails.dpdk.org (Postfix) with ESMTP id 780F240141; Tue, 31 Aug 2021 16:22:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=GffvH DmgIBHJyE+i1XQEeXvtwu1UlFDeLReH80rASBY=; b=HoMVbqnYVkadgVVBGsdoY FvsUjH+NG4ieEoSxyG0nmm79HDUcVeO5tnCf/vBljFldE1AwDReNlFVzuLd/C1tE 4qIoj2k4ZQY45Q3GC5Lf7SSiTzH5s+v+W/8iCWfHifMHwFlrKD1Av9Gv1QOwP+qe /72th3VzoVmXq+hJ/ECOP8= Received: from localhost.localdomain (unknown [124.160.214.152]) by smtp3 (Coremail) with SMTP id G9xpCgBXHKsUOy5hC14SFA--.371S2; Tue, 31 Aug 2021 22:22:14 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: haiyue.wang@intel.com, Qiming Chen , stable@dpdk.org Date: Tue, 31 Aug 2021 22:21:31 +0800 Message-Id: <20210831142131.9295-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: <20210831135746.8639-1-chenqiming_huawei@163.com> References: <20210831135746.8639-1-chenqiming_huawei@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: G9xpCgBXHKsUOy5hC14SFA--.371S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFyruw4xKr17Zr13Kr47CFg_yoW8GF45pa 97GFyrAFyjqrs7Cws5Za1fury7ua92q3yUKFy5A345u3s8ZF92kr1DJ3W0yFyqyrW8AF42 yF10krZruanI9a7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jPZ2fUUUUU= X-Originating-IP: [124.160.214.152] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBURYAoFaD-9oDIAAAs0 Subject: [dpdk-stable] [PATCH v2] net/ixgbe: fix mac resourece leak X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" In the eth_ixgbevf_dev_init and eth_ixgbe_dev_init functions, memory is allocated for the MAC address, and the address is stored in the eth_dev->data->mac_addrs member variable. If the subsequent function is abnormal, you need to use the rte_free function to release the MAC address memory. Fixes: abf7275bbaa2 ("ixgbe: move to drivers/net/") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- v2: Clear coding style warning. --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 7d3a821300..6a91f104e1 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1218,6 +1218,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) PMD_INIT_LOG(ERR, "Failed to allocate %d bytes needed to store MAC addresses", RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return -ENOMEM; } @@ -1672,6 +1674,8 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) default: PMD_INIT_LOG(ERR, "VF Initialization Failure: %d", diag); + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; return -EIO; } -- 2.30.1.windows.1