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 A3FD9A034F for ; Wed, 10 Nov 2021 07:36:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D99040142; Wed, 10 Nov 2021 07:36:03 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) by mails.dpdk.org (Postfix) with ESMTP id 6C40340142 for ; Wed, 10 Nov 2021 07:36:02 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dsx2IcD9CgkYM5YbpdcJric/jtsHD8h+l6KvfgJggSzX2cOZ0qEUocGwZWdwyMRbvTroUuyBsmtEiCR/MdCc8dwMr+ROSz28ReCJHTsL8MaH/kZmOVkeMfHQlhY+dNnW9oFdn6Dgk4nx596AgFNAOKhesx1qhWmaKR/gakip6FW20jLwhHRmRspf6HCoH1WjdCh0ASJIUBKpQNGD0mNiHuNF2mgRnazJpuwKAYtc4K1J5ETDCFRNMhELxjMv2GHDyyVCgFE8NZSFANv0ktGyGLm7ttJjMuaRK1D1ZT5WoaICdpNIIx3+B35mmi+MWwYz0cAVpHXn+bIM6r6H17tGTg== 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=ElV5LMMNLw1b9+pSTtFn0il/0s1Mi/8qNWCAdPKi7Pw=; b=mVnVh5kj1ofDq7S4FruotVi27BCsgJbdjuwiTS6ID9vRor7WqhrdUWVeQJiz+HQaJlX60WC/v5h/6kSynjxY58Vf6y50aaB/IRYkYRc8r1nzn+6wSqJnkJdlDeUuEksq+pGj/Rw0ij1u8JXBBnl/fJwkHia84+TBqhUWVtFePHZuVl9vTYC3rS6lNb/d3B4xOdiIqlYxiBseQYGukwkn2U1BeAd5ww8hw7uth+9DXQUBkQCSy7z9DOn4dBwkD9cU0EpG4ZiOEV1XIwkonjm1m6dJHcm4ozvJI0SQ+NFp/wVurykt0gFBH7juGWNuRnBEem36mNJOVaOq9s9/w1plkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=intel.com smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none 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=ElV5LMMNLw1b9+pSTtFn0il/0s1Mi/8qNWCAdPKi7Pw=; b=s3GH17diFbELQJIvGT7kcrSvzXTipSb0dr4iaHd5qamzXrcGb83KLQ1HsdTbijfYjc2unqBM3LKX5GU6CsidFgZKhjRAvIT3gYdAD6PJYKkoyy16ja2pqzPeSxUd+tqYNGwPLbQ6/kr6H4cWhmc9fi+KDHIEAv5RBGf09AxC2D8mogwbKYiydQhO9kD0oBlkKUNE92SL6sCqSMj+qRXUJIbCfSNSio74/geZjDY/VhZL0QbknYW1LNIIsMfB1Ltir+vgOLJtIwshUIuXB6+2VlbGmWlU5YaHP9AW5OO91ePcKNKoLuGuj0ssszclErQcUHmt9n2FgZjMuT+ojVJC3w== Received: from DS7PR03CA0065.namprd03.prod.outlook.com (2603:10b6:5:3bb::10) by DM5PR1201MB2536.namprd12.prod.outlook.com (2603:10b6:3:e9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.15; Wed, 10 Nov 2021 06:36:01 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::15) by DS7PR03CA0065.outlook.office365.com (2603:10b6:5:3bb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.16 via Frontend Transport; Wed, 10 Nov 2021 06:36:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4690.15 via Frontend Transport; Wed, 10 Nov 2021 06:36:00 +0000 Received: from nvidia.com (172.20.187.6) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 10 Nov 2021 06:35:58 +0000 From: Xueming Li To: Qiming Chen CC: Luca Boccassi , Ferruh Yigit , dpdk stable Date: Wed, 10 Nov 2021 14:28:38 +0800 Message-ID: <20211110063216.2744012-35-xuemingl@nvidia.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211110063216.2744012-1-xuemingl@nvidia.com> References: <20211110063216.2744012-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.20.187.6] X-ClientProxiedBy: HQMAIL101.nvidia.com (172.20.187.10) To HQMAIL107.nvidia.com (172.20.187.13) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 44cac7d5-cf2c-4cb9-6504-08d9a4145c5c X-MS-TrafficTypeDiagnostic: DM5PR1201MB2536: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4K1Lh7xt9Jv3FwhoJs99RjTv+H4dcOGqbtkdbohjPSmQFlMtenTHWpkx9lEdwquQodGVDZb3/ZIHbfxlNLfCh4ma08om9YPAf+A2komCT4ltFTjNHFS+g1Zn1VAECrW9lJjfncafgnRm2bT+0M/WybgaExVcqrSewIUj5ijCx8UEMgdqbXoSScfrPwYtzviQp6Qo6lO24U1O7QR9nCUxgpepOcdk+cE8pjnupAl13Dw9ixu0D9UHPyXV1PsI+9epsRSpeqvH910Ytz7oR/jPBnAisCKGnVo+x7I4pTCg04mocBlZ2LNlh9IMdzr94wd4JIPBzaTShUHhtTn/S0bK8wFzhBwzhMl1KeOxSo+VRZXsbnf/0pJjRyIuveVikq4lrpynXSBc/GRjIs1Psfv1IIGCfkIGIt1FOLXuJNOkOvcq4HD4dp+cqF2NMv5dqMuwh433A7DvWB3UM5wVqFpVOu4wrZ8D31cwvcmKv1lRHTs7NLxuHcewZj2TjP2ePWyGBYWpqtXP7YccE5eIiktyD1mGz/zAip7SnojUMTry52mw0wKq29eZJCtL/TXk8DjuY5nxkgkYen3rYOPIJT8bRm6xpyjASwU2+wO4MT9fE22wr99wrs1OD1PuREoDXVv5oppr+GPdtZ1bg5rKkSDycayi/q9Gva4abS4htnqSc7PrYDBekoTB2xAPBkKDFoereQRtVX1uqE75N1Cq+Tf9exyL/b9ERc/pcq9YI6Wmi6YM+oBjfsmJix7RihqTUKwldvo2fmtwtp04kMPav4TcvfIbmr7Cw59/03DRA/dnAhvylKzg0FYYfuBwWMykSV1MCT0RgiHwsImP5UDkS7Z5Ug== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(53546011)(82310400003)(26005)(7696005)(186003)(47076005)(8936002)(55016002)(83380400001)(6916009)(966005)(7636003)(70206006)(316002)(6286002)(54906003)(6666004)(86362001)(508600001)(4001150100001)(336012)(4326008)(426003)(70586007)(16526019)(8676002)(5660300002)(36860700001)(2906002)(1076003)(356005)(2616005)(36756003); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2021 06:36:00.4376 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44cac7d5-cf2c-4cb9-6504-08d9a4145c5c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB2536 Subject: [dpdk-stable] patch 'net/pcap: fix resource leakage on port probe' has been queued to stable release 20.11.4 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" Hi, FYI, your patch has been queued to stable release 20.11.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/12/21. 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://github.com/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/6b6aacee7102439684c272bd1513eff6e70cdffd Thanks. Xueming Li --- >From 6b6aacee7102439684c272bd1513eff6e70cdffd Mon Sep 17 00:00:00 2001 From: Qiming Chen Date: Mon, 30 Aug 2021 11:01:08 +0800 Subject: [PATCH] net/pcap: fix resource leakage on port probe Cc: Xueming Li [ upstream commit da0280b3a34c6f67f7e558fcc86c3110816fea28 ] When the port is probed, if the eth_from_pcaps function fails, the previously opened pcap resources are not released, causing resource leakage. The patch solves the problem of resource leakage caused by abnormal branch exit during the port probe process. Fixes: 4c173302c307 ("pcap: add new driver") Signed-off-by: Qiming Chen Acked-by: Ferruh Yigit --- drivers/net/pcap/rte_eth_pcap.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index da4dfe799e..2e8ac55b72 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1366,6 +1366,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev, return 0; } +static void +eth_release_pcaps(struct pmd_devargs *pcaps, + struct pmd_devargs *dumpers, + int single_iface) +{ + unsigned int i; + + if (single_iface) { + if (pcaps->queue[0].pcap) + pcap_close(pcaps->queue[0].pcap); + return; + } + + for (i = 0; i < dumpers->num_of_queue; i++) { + if (dumpers->queue[i].dumper) + pcap_dump_close(dumpers->queue[i].dumper); + + if (dumpers->queue[i].pcap) + pcap_close(dumpers->queue[i].pcap); + } + + for (i = 0; i < pcaps->num_of_queue; i++) { + if (pcaps->queue[i].pcap) + pcap_close(pcaps->queue[i].pcap); + } +} + static int pmd_pcap_probe(struct rte_vdev_device *dev) { @@ -1586,6 +1613,9 @@ create_eth: free_kvlist: rte_kvargs_free(kvlist); + if (ret < 0) + eth_release_pcaps(&pcaps, &dumpers, devargs_all.single_iface); + return ret; } -- 2.33.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-10 14:17:03.635612892 +0800 +++ 0034-net-pcap-fix-resource-leakage-on-port-probe.patch 2021-11-10 14:17:01.780746827 +0800 @@ -1 +1 @@ -From da0280b3a34c6f67f7e558fcc86c3110816fea28 Mon Sep 17 00:00:00 2001 +From 6b6aacee7102439684c272bd1513eff6e70cdffd Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit da0280b3a34c6f67f7e558fcc86c3110816fea28 ] @@ -14 +16,0 @@ -Cc: stable@dpdk.org @@ -19 +21 @@ - drivers/net/pcap/pcap_ethdev.c | 30 ++++++++++++++++++++++++++++++ + drivers/net/pcap/rte_eth_pcap.c | 30 ++++++++++++++++++++++++++++++ @@ -22,5 +24,5 @@ -diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c -index a8774b7a43..5c4cdbf873 100644 ---- a/drivers/net/pcap/pcap_ethdev.c -+++ b/drivers/net/pcap/pcap_ethdev.c -@@ -1362,6 +1362,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev, +diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c +index da4dfe799e..2e8ac55b72 100644 +--- a/drivers/net/pcap/rte_eth_pcap.c ++++ b/drivers/net/pcap/rte_eth_pcap.c +@@ -1366,6 +1366,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev, @@ -60 +62 @@ -@@ -1582,6 +1609,9 @@ create_eth: +@@ -1586,6 +1613,9 @@ create_eth: