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 7CCD8A0C53; Wed, 1 Sep 2021 09:12:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 049BC4013F; Wed, 1 Sep 2021 09:12:59 +0200 (CEST) Received: from mail-m972.mail.163.com (mail-m972.mail.163.com [123.126.97.2]) by mails.dpdk.org (Postfix) with ESMTP id 40C6340041; Wed, 1 Sep 2021 09:12:57 +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=riMqI I5523ZwdRdmM6KHzLbtaXMgKKW7oMFVSoG4u0Y=; b=R47mKWj8lkGCK9uHCSHm6 4h2D1s8HKQwA9rcj1DgWC0D2BnoaGgFVnhNaU4Vh9M+SReojckfhSFJCHjS7u/lJ YgXjgu3FjxpypZSiV4aS5pg7AMZ+xrXrulh+VxefFVKILayl0YUOtRhkYUO+DLsH 7tivrmcbxWCqgCxKCOegCk= Received: from localhost.localdomain (unknown [124.160.213.27]) by smtp2 (Coremail) with SMTP id GtxpCgD31v7xJy9h2Z1sQw--.254S2; Wed, 01 Sep 2021 15:12:53 +0800 (CST) From: Qiming Chen To: dev@dpdk.org Cc: haiyue.wang@intel.com, Qiming Chen , stable@dpdk.org Date: Wed, 1 Sep 2021 15:12:07 +0800 Message-Id: <20210901071207.9379-1-chenqiming_huawei@163.com> X-Mailer: git-send-email 2.30.1.windows.1 In-Reply-To: <20210831142131.9295-1-chenqiming_huawei@163.com> References: <20210831142131.9295-1-chenqiming_huawei@163.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: GtxpCgD31v7xJy9h2Z1sQw--.254S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7uFyruw4xtw1xZF48GFy3urg_yoW8GFyfpa 97GFyrAFyjqrs7Cws5Za1rZry7ua92qw4UKFW5Aw1Y9345ZFn2kr1DA3W8tFyqyr48Ar42 yF10krZrua129a7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jxF4iUUUUU= X-Originating-IP: [124.160.213.27] X-CM-SenderInfo: xfkh01xlpl0w5bkxt4lhl6il2tof0z/1tbiDhUBoFXl1MHpXAAAsq Subject: [dpdk-dev] [PATCH v3] 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 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: af75078fece3 ("first public release") Cc: stable@dpdk.org Signed-off-by: Qiming Chen --- v2: Clear coding style warning. v3: Modify fixes commit. --- 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