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 1D6A943B86 for ; Tue, 5 Mar 2024 10:54:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1886442E2D; Tue, 5 Mar 2024 10:54:50 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2072.outbound.protection.outlook.com [40.107.244.72]) by mails.dpdk.org (Postfix) with ESMTP id C89E64014F for ; Tue, 5 Mar 2024 10:54:48 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S8nIrQ0bMzzC4RixmYXjGsoOJbeAYmxJIj5nZvPkA/9Y6iw8Cs0MmL8KtQuoPT8Uk1iFFziOLEdhEciLsfLBSZkcuk8MbSiqBr8vOMApuzsaTvzXxCX5i7W8OMxvFNRCEu+XcTE81xBpOYf54XhAOKmbB/iomRPauZbn20iD8o2fxnD86w+vEH7ghZFW94oogVtD+8lS14uJzCrZjGGwF/o6rTN/aRSQP25lqijAGF9b7bvdAM/DruEkrdhZhy0tjgNkoXx3VZqGufr1+15AZtwQYpmRm+YFXSyNVHfXnAraFSqsU5YDx+lUIvz/rCu7cvdutAdHB9BU4ExlZYcJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S09FLpAr+HDfdXcGTsx85+hCH9TCya5ixItwIikMRNU=; b=l+Q2AyudCLXOuLTkNqyjT3rUvgreU0Q0IucFpcsrw/v9LB3v2p7z1AvGZhxKHOwlwMG35pGHtzUmzW9dxJ7ySn0z97tL8Mgk7KgC9mmmwU9HHJng2fo3R8UHAJQb9cmoIgwfY42GtcPh3NcwSYWaNhs6v3L4c7jLEJWqTd6lOb/gk4uCBokF0Ol0WASLb/cPWtok37Fx4N6srk1gVS/xBVk9BGGCSNFSh+IQIsr8iMh/vstbcUjvbk6YvUgK1A+XmRm0Y5aBAsOnvmcxOqoJM153dBWpYZ8GQq6Vwzg+Pu+wTiTuODsbXOt7V2YVaOA9fhdAXeOuKapfAxlm6kx5zA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=corigine.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S09FLpAr+HDfdXcGTsx85+hCH9TCya5ixItwIikMRNU=; b=s+hwzjxztJgIgbeOyyKdX4s8xwszJDmEsBW1Br3cIC3MVOEpxpiOUw01BlbOp5vE/lJ/N7IlPRN7ZzFjJVtQWBBuVohmLekYUhrmHX9m2WNs9gq+i13rG5a9lGsBufZUg9yYlVuTXrV+vRK9YsuTxMT6Bid9OE4p1u5XOz51oVTWj/O6QvtoirY2XBD3NZLRYYdV9dO3FwRJT0Xo9PI9rhn0xuBcAebHu1F1XtclyKSbXN1aGIvEgF0r/ooFEA3Q8rdW4G1i5uzya3Rr/GsNpcfQY2pjh3/hDjy6J9ocdiBw3/09Q7UxJC4Q3J+bEkddEybf4SRiiqWZqmqQ2TzLkw== Received: from BYAPR02CA0031.namprd02.prod.outlook.com (2603:10b6:a02:ee::44) by MW4PR12MB7312.namprd12.prod.outlook.com (2603:10b6:303:21a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.38; Tue, 5 Mar 2024 09:54:45 +0000 Received: from SJ5PEPF000001D5.namprd05.prod.outlook.com (2603:10b6:a02:ee:cafe::fc) by BYAPR02CA0031.outlook.office365.com (2603:10b6:a02:ee::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Tue, 5 Mar 2024 09:54:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SJ5PEPF000001D5.mail.protection.outlook.com (10.167.242.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.11 via Frontend Transport; Tue, 5 Mar 2024 09:54:45 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Tue, 5 Mar 2024 01:54:31 -0800 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Tue, 5 Mar 2024 01:54:30 -0800 From: Xueming Li To: Chaoyong He CC: Long Wu , Peng Zhang , "dpdk stable" Subject: patch 'net/nfp: fix resource leak for device initialization' has been queued to stable release 23.11.1 Date: Tue, 5 Mar 2024 17:46:54 +0800 Message-ID: <20240305094757.439387-74-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305094757.439387-1-xuemingl@nvidia.com> References: <20240305094757.439387-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D5:EE_|MW4PR12MB7312:EE_ X-MS-Office365-Filtering-Correlation-Id: 0be56519-90d5-4904-6f92-08dc3cfa498d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NNhLPgx/EV6vzETh6YcpS+QarYGx9cTxrokDTSknqfKaSyu7bYlvHKnsHdBy4YgYpjUv1RdC5+lx3+W6thgFxgYuL48eNTn5gJzvE6LgFkwfPiEILwpP4/Ejr05E8m2G9UGgAEo6acwladRQB5vcnDZQos0YGFS4gms81UFOGFonPWcJdzB07tbqOiGa1zFNMOYwTJbTnFAKL4EKbUrchgIkzPykNchMxqJBElDf3hpaCComaC5BCeWNgFLz8x8YHwjp4CZXStas+IAhSl0b+tEd5onWg83fn+2o5sDgKqxt8Tn9hhrlNmbVN8vxwfrPmFraPblv22A6oCpCDI1KhIaMtkT14PlOYntYuhEoNni0Uf56XmvsQxa3i2YdGGFKv5Q1+B/g4HV4RFCzKfOiA1lA8javDEAClidXfPBPqmfl0xiakVpx7ffQK6CT7HMXQMRbncdZbUWH4p9ztpDhyYCxN0NXvfDPVMVXB8tiftblA3oDi4wG9w/7nZTQBHR7VBnSwYkgxUWWzMiWDCYF9aa30H//04nA4b/ufrg4OjHOMBCGjgxxvLZvWQ27+3nII4lav0gnvFQpmWQdq75IldGsJNkvO0AtFVChxLNkzWGDCobuStSTAqAemlxSDkU8lHcv0l8gviqs2C9XOWJffLtKZXgBrV8vWXgH6KHX+qCw1f0DDSaisIrUw3TcDBpJ0QoVHfzbyjUWPWjGzh40xcXurxbETJmJ1mi+ZJJv0dbici5cLUInIy/0gRxCjkO1 X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(36860700004)(82310400014)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Mar 2024 09:54:45.3108 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0be56519-90d5-4904-6f92-08dc3cfa498d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7312 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 Hi, FYI, your patch has been queued to stable release 23.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/31/24. 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. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=f2ee31d52cdea323cbc686c99f5131cf22f4b250 Thanks. Xueming Li --- >From f2ee31d52cdea323cbc686c99f5131cf22f4b250 Mon Sep 17 00:00:00 2001 From: Chaoyong He Date: Mon, 4 Dec 2023 09:57:12 +0800 Subject: [PATCH] net/nfp: fix resource leak for device initialization Cc: Xueming Li [ upstream commit 3699456672516a11bf6cb4b456618d2dd12080e4 ] Fix the resource leak problem in the abnormal logic of device initialize function. Fixes: f26e82397f6d ("net/nfp: implement xstats") Fixes: 547137405be7 ("net/nfp: initialize IPsec related content") Signed-off-by: Chaoyong He Reviewed-by: Long Wu Reviewed-by: Peng Zhang --- drivers/net/nfp/nfp_ethdev.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c index f02caf8056..25feb8e394 100644 --- a/drivers/net/nfp/nfp_ethdev.c +++ b/drivers/net/nfp/nfp_ethdev.c @@ -590,9 +590,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) net_hw->mac_stats = net_hw->mac_stats_bar; } else { - if (pf_dev->ctrl_bar == NULL) - return -ENODEV; - /* Use port offset in pf ctrl_bar for this ports control bar */ hw->ctrl_bar = pf_dev->ctrl_bar + (port * NFP_NET_CFG_BAR_SZ); net_hw->mac_stats = app_fw_nic->ports[0]->mac_stats_bar + @@ -604,18 +601,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev) err = nfp_net_common_init(pci_dev, net_hw); if (err != 0) - return err; + goto free_area; err = nfp_net_tlv_caps_parse(eth_dev); if (err != 0) { PMD_INIT_LOG(ERR, "Failed to parser TLV caps"); return err; + goto free_area; } err = nfp_ipsec_init(eth_dev); if (err != 0) { PMD_INIT_LOG(ERR, "Failed to init IPsec module"); - return err; + goto free_area; } nfp_net_ethdev_ops_mount(net_hw, eth_dev); @@ -625,7 +623,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) if (net_hw->eth_xstats_base == NULL) { PMD_INIT_LOG(ERR, "no memory for xstats base values on device %s!", pci_dev->device.name); - return -ENOMEM; + err = -ENOMEM; + goto ipsec_exit; } /* Work out where in the BAR the queues start. */ @@ -655,7 +654,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0); if (eth_dev->data->mac_addrs == NULL) { PMD_INIT_LOG(ERR, "Failed to space for MAC address"); - return -ENOMEM; + err = -ENOMEM; + goto xstats_free; } nfp_net_pf_read_mac(app_fw_nic, port); @@ -693,6 +693,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev) nfp_net_stats_reset(eth_dev); return 0; + +xstats_free: + rte_free(net_hw->eth_xstats_base); +ipsec_exit: + nfp_ipsec_uninit(eth_dev); +free_area: + if (net_hw->mac_stats_area != NULL) + nfp_cpp_area_release_free(net_hw->mac_stats_area); + + return err; } #define DEFAULT_FW_PATH "/lib/firmware/netronome" -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-05 17:39:33.179452373 +0800 +++ 0073-net-nfp-fix-resource-leak-for-device-initialization.patch 2024-03-05 17:39:30.803566494 +0800 @@ -1 +1 @@ -From 3699456672516a11bf6cb4b456618d2dd12080e4 Mon Sep 17 00:00:00 2001 +From f2ee31d52cdea323cbc686c99f5131cf22f4b250 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 3699456672516a11bf6cb4b456618d2dd12080e4 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +23 @@ -index 9e40bce4dd..2a80a592f2 100644 +index f02caf8056..25feb8e394 100644 @@ -24 +26 @@ -@@ -597,9 +597,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) +@@ -590,9 +590,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev) @@ -34 +36 @@ -@@ -611,18 +608,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev) +@@ -604,18 +601,19 @@ nfp_net_init(struct rte_eth_dev *eth_dev) @@ -56 +58 @@ -@@ -632,7 +630,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) +@@ -625,7 +623,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) @@ -66 +68 @@ -@@ -662,7 +661,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) +@@ -655,7 +654,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev) @@ -76 +78 @@ -@@ -700,6 +700,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev) +@@ -693,6 +693,16 @@ nfp_net_init(struct rte_eth_dev *eth_dev)