From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA697A04F3 for ; Thu, 19 Dec 2019 15:38:49 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BDC561BFCD; Thu, 19 Dec 2019 15:38:49 +0100 (CET) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by dpdk.org (Postfix) with ESMTP id 4CA4B1BFCD for ; Thu, 19 Dec 2019 15:38:48 +0100 (CET) Received: by mail-wm1-f68.google.com with SMTP id t14so5844447wmi.5 for ; Thu, 19 Dec 2019 06:38:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WbLQEG3TQlOb0EzgH4gmF6UQ7EuJ4O86Ht9TYzVY5UY=; b=f3ulz2E3PxRtZTszHxpS6DHLkUEAs/1fA81W/FBkSE+1LLLlMMDcCwphPRfM5Ni8+j 4JvJ27dLVPhQNc153VGozdb2UMDQcpO9pPRmOnE+bHRVlQIb65Y+A2+NAM+w6stAQLvW /8SBOejGVB3s4M16lF1fYKnM8JqB72kOsKkSMmcotLRo4sR7t4JfGeJwBbjOuNToCiVL 8gMABrpeU4kGMk0ClOiCi93MjGkcvb72jVhD33BbtLvQkt7gl0uf3uUC/XOcs+W0Wqst zVutNtbtL4OfZK1bQQtoCTK/PiRLlkG6GioHJPZHXiRaqUtQuggjASbUMr18RXyT0Pn5 qKZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WbLQEG3TQlOb0EzgH4gmF6UQ7EuJ4O86Ht9TYzVY5UY=; b=Xfts0Jp9hUvpmUbKCLhHZLXBrBW3/PbHpes/tcaGk9uTCQona8Ghzb2JPyxg6slA8B Yw9IelGr4T8KlRh29TnHbpowx0DF4mX9ZF/8gR7xF3BgKfPnPlVpf7PZ/NPEiUTKqHJh PLxL1rbIPRsy8TFsrOTe2letc578WOF2b+kzKlSzUoec38z5edYxNYzUfcRni97svKRi VH1Kn7uniXczC0OODnGNoiE210RvLxBc8XrewKCQn4ZC0YMdYcrgrfQ/eTEB4Lqqc1Qn bL9XxNwoCBn+Um1duIahrpbpQa8p6v8Z72YuW6cdh/v29eZSPNXU1LjDSkk7dQCCwE6M yIHw== X-Gm-Message-State: APjAAAUfVjbB5b3O6y311ne+Rq+fBV43HBIRBxjc6MWaYj6CTixnGA4S vVtaRPksmQG1ACaL0vZ+AeTjJTb1gFw= X-Google-Smtp-Source: APXvYqxRqc5Qzy/vS5cbIMs71f8yi9k/Di1Enoj/vcErs0yTKJfUi+pX7jX2mNZGrSzmFGhZuL263Q== X-Received: by 2002:a05:600c:24d1:: with SMTP id 17mr10278556wmu.136.1576766327944; Thu, 19 Dec 2019 06:38:47 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id s1sm6417020wmc.23.2019.12.19.06.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Dec 2019 06:38:47 -0800 (PST) From: luca.boccassi@gmail.com To: Kalesh AP Cc: Somnath Kotur , Santoshkumar Karanappa Rastapur , dpdk stable Date: Thu, 19 Dec 2019 14:33:57 +0000 Message-Id: <20191219143447.21506-90-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191219143447.21506-1-luca.boccassi@gmail.com> References: <20191219143447.21506-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/bnxt: fix memory leak' has been queued to LTS release 17.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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" Hi, FYI, your patch has been queued to LTS release 17.11.10 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/21/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From 318e5f390a4fae5057bb3ac134d18c5b4267c54d Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 24 Oct 2019 13:14:31 +0530 Subject: [PATCH] net/bnxt: fix memory leak [ upstream commit f5019a53d7fc82474710c98bb48b4a09ee07c9f7 ] During hot fw upgrade or error recovery, driver does cleanup and reallocation of resources. But driver reallocates memory for ring group info table without freeing the allocated memory during device init. Fix this memory leak by moving the freeing of ring group info table to bnxt_free_mem() in bnxt_uninit_resources(). Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations") Signed-off-by: Kalesh AP Signed-off-by: Somnath Kotur Reviewed-by: Santoshkumar Karanappa Rastapur --- drivers/net/bnxt/bnxt_ethdev.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7610626306..1a6d09f9d3 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -125,6 +125,9 @@ static void bnxt_free_mem(struct bnxt *bp) bnxt_free_tx_rings(bp); bnxt_free_rx_rings(bp); bnxt_free_def_cp_ring(bp); + + rte_free(bp->grp_info); + bp->grp_info = NULL; } static int bnxt_alloc_mem(struct bnxt *bp) @@ -3079,10 +3082,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) { rte_free(eth_dev->data->mac_addrs); eth_dev->data->mac_addrs = NULL; } - if (bp->grp_info != NULL) { - rte_free(bp->grp_info); - bp->grp_info = NULL; - } rc = bnxt_hwrm_func_driver_unregister(bp, 0); bnxt_free_hwrm_resources(bp); rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone); -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-12-19 14:32:29.930625309 +0000 +++ 0090-net-bnxt-fix-memory-leak.patch 2019-12-19 14:32:26.217300046 +0000 @@ -1,8 +1,10 @@ -From f5019a53d7fc82474710c98bb48b4a09ee07c9f7 Mon Sep 17 00:00:00 2001 +From 318e5f390a4fae5057bb3ac134d18c5b4267c54d Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 24 Oct 2019 13:14:31 +0530 Subject: [PATCH] net/bnxt: fix memory leak +[ upstream commit f5019a53d7fc82474710c98bb48b4a09ee07c9f7 ] + During hot fw upgrade or error recovery, driver does cleanup and reallocation of resources. But driver reallocates memory for ring group info table without freeing the allocated memory during @@ -12,41 +14,39 @@ to bnxt_free_mem() in bnxt_uninit_resources(). Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations") -Cc: stable@dpdk.org Signed-off-by: Kalesh AP Signed-off-by: Somnath Kotur Reviewed-by: Santoshkumar Karanappa Rastapur --- - drivers/net/bnxt/bnxt_ethdev.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) + drivers/net/bnxt/bnxt_ethdev.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c -index 013b968355..9642796eeb 100644 +index 7610626306..1a6d09f9d3 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c -@@ -183,6 +183,9 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig) - } - bnxt_free_async_cp_ring(bp); - bnxt_free_rxtx_nq_ring(bp); +@@ -125,6 +125,9 @@ static void bnxt_free_mem(struct bnxt *bp) + bnxt_free_tx_rings(bp); + bnxt_free_rx_rings(bp); + bnxt_free_def_cp_ring(bp); + + rte_free(bp->grp_info); + bp->grp_info = NULL; } - static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig) -@@ -4821,11 +4824,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) - - rc = bnxt_uninit_resources(bp, false); - + static int bnxt_alloc_mem(struct bnxt *bp) +@@ -3079,10 +3082,6 @@ bnxt_dev_uninit(struct rte_eth_dev *eth_dev) { + rte_free(eth_dev->data->mac_addrs); + eth_dev->data->mac_addrs = NULL; + } - if (bp->grp_info != NULL) { - rte_free(bp->grp_info); - bp->grp_info = NULL; - } -- - if (bp->tx_mem_zone) { - rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone); - bp->tx_mem_zone = NULL; + rc = bnxt_hwrm_func_driver_unregister(bp, 0); + bnxt_free_hwrm_resources(bp); + rte_memzone_free((const struct rte_memzone *)bp->tx_mem_zone); -- 2.20.1