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 81295A0C46; Tue, 31 Aug 2021 15:58:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 430324013F; Tue, 31 Aug 2021 15:58:36 +0200 (CEST) Received: from mail-m971.mail.163.com (mail-m971.mail.163.com [123.126.97.1]) by mails.dpdk.org (Postfix) with ESMTP id B774940041; Tue, 31 Aug 2021 15:58:33 +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=V97vm leMAPAXTgibPAtlo2x23fkNTlv7Ig4yG9alzDU=; b=Ees8/s3Jji0B4cR3C9rDI n6dXSEdEcSkp8/qoBDgwvOOFsoslELWgoeLQOpFSucrCsR4kNboz9KIXxFBI4u2x Yloeuk09mw+iGik7SOGCuaSSHYME+yogS7X0H4HX4HmGd9vzljcn3XPXVkiy7Qjk Lzm6tmTem/6L0jG7RuS+Ao= Received: from localhost.localdomain (unknown [124.160.214.152]) by smtp1 (Coremail) with SMTP id GdxpCgBnb0OENS5hvXIEAQ--.20625S2; Tue, 31 Aug 2021 21:58:30 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: haiyue.wang@intel.com, Qiming Chen , stable@dpdk.org Date: Tue, 31 Aug 2021 21:57:46 +0800 Message-Id: <20210831135746.8639-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GdxpCgBnb0OENS5hvXIEAQ--.20625S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFyruw4xKr17Zr13Kr47CFg_yoW8GryUpa 97Ga4rAFyjqrs7Cws5Za1rury7ua92q3yUKFy5A345u3s8ZF92kr1DJ3W0yFyqyr48AF42 yF10krZruanxua7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jma0QUUUUU= X-Originating-IP: [124.160.214.152] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/xtbBZBAAoFQHOTtqSQAAsm Subject: [dpdk-dev] [PATCH] net/ixgbe: fix mac resourece leak 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 Sender: "dev" In the eth_ixgbevf_dev_init and eth_ixgbe_dev_init functions, memory is alloced 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 --- 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