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 355C5A054F; Tue, 2 Mar 2021 17:52:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C131C40693; Tue, 2 Mar 2021 17:52:32 +0100 (CET) Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-oln040092253058.outbound.protection.outlook.com [40.92.253.58]) by mails.dpdk.org (Postfix) with ESMTP id CB5DD40142; Tue, 2 Mar 2021 17:52:30 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOGxp3TK5UlMr9oNmVwxmwgz85SLGodcw4ZdJM8Nw6q5mlhPZOAb/T6pJehpRstCnIjdfnipEb1/gmqZI6lKn2fv7SPAZPIiqEKMeR+NtvTPFYE6fT56cFi/MhF17dKvpTILp9L3owl+b+sOJox+B+aaVCkn1ec7C/wDmpfY2GgU5Kxvrp4vnp0NS+VFaV6Lo2hq0THrzWr1cOV1+Kfk8XoifrLf1xOEFGxVXZv1o4aspBAU9KE314Gap46gy4sewEm+qImmKuQ3RWpIEshgn7jg6gUqfMrkNCUb/UtECdkdavX7nEqaif8pDjPyjlfdsnoNR5m9neNmrVRjn2+Y/Q== 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-SenderADCheck; bh=RSyf1sjqwNaa7uEAQegjLJdIW9OGj4gqWnMRutnVdMk=; b=k4mIVct1kb5mh/q3p48fn0WVaLQC2lZccQuz9cexv3ITrjGW40qI3FCWiio8WIfZYsEHw+XXyXVroJTrhVg/XvdKm2GMq0evJLD3JtCNqvPHWs2FGYzzFDdsvKVVlVzPiQbWW+zSAauN9/Vw75YT/IHl9qimQPsXxZeXceAIbN4IqEks5KcJajpExG6SYMiqjGkzuyUIFljNqg2sT0irmUqyQ5LQV3kevFRKV6ITN37jMmwPEsu/Bk+HBXVeXS+8nJ+gxNMDFw7zpMG6PjUS+FKbLB2CspSRhxnLESWLOgWyKChasI8YvWFgc34pF13hVmX9E2d9qb936ejOQ4FQsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RSyf1sjqwNaa7uEAQegjLJdIW9OGj4gqWnMRutnVdMk=; b=c+sroATROWUaG9Iog7G2JDcSkAq/WxgEtni7jb2236ezXikkVqVQgyeRMisMS7mnR3HA4hZHkuLXW7C/H3GC+Om/JZR2DIFToWHzF3L4xnXLmD0P83UmuWc/sIQBw8Du8b6DsGFR4ZTBYjIjDo0JfaTv2npc+8vN7fMepbJy8i7GoOyZaovOCEFJku7IKaLYHEjpwtYB9yDpRAszCmN8HiLxuApvKXkhmcpZuxSzGStgLh0XaT86B5OJf9dw61TxbE+PX3+bM6cmX2IQM3Ewq+Ul5R8hvHM/7etqnPofVoUR0lTkhhww15XjrNUNIKPa5iLo39bojhOTU3xwBwbSaA== Received: from HK2APC01FT034.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::40) by HK2APC01HT124.eop-APC01.prod.protection.outlook.com (2a01:111:e400:7ebc::459) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19; Tue, 2 Mar 2021 16:52:28 +0000 Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2a01:111:e400:7ebc::44) by HK2APC01FT034.mail.protection.outlook.com (2a01:111:e400:7ebc::191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Tue, 2 Mar 2021 16:52:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:08148EB55639F1AB33CD14183D85E51AC26B04E5F5DE5983E64FD28E89151F00; UpperCasedChecksum:B3E658152151337D0F09F459F1BA74D1A2FE80EE8B69E6A34AF12C3576D4A592; SizeAsReceived:7320; Count:45 Received: from ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::cde5:5660:e27b:a333]) by ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM ([fe80::cde5:5660:e27b:a333%8]) with mapi id 15.20.3912.017; Tue, 2 Mar 2021 16:52:28 +0000 From: Tengfei Zhang To: Ferruh Yigit Cc: dev@dpdk.org, Tengfei Zhang , stable@dpdk.org Date: Tue, 2 Mar 2021 16:51:30 +0000 Message-ID: X-Mailer: git-send-email 2.25.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [THZ01dDhKdFrahT2ontMv/JCItKO/GuI] X-ClientProxiedBy: HK2PR0401CA0024.apcprd04.prod.outlook.com (2603:1096:202:2::34) To ME3P282MB1668.AUSP282.PROD.OUTLOOK.COM (2603:10c6:220:a5::11) X-Microsoft-Original-Message-ID: <20210302165130.130623-1-zypscode@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (222.95.177.75) by HK2PR0401CA0024.apcprd04.prod.outlook.com (2603:1096:202:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17 via Frontend Transport; Tue, 2 Mar 2021 16:52:26 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 855527a7-ea94-4da7-7436-08d8dd9b901d X-MS-Exchange-SLBlob-MailProps: mBRmoEB1kyJjxBJ9XFEbnzYN3mV272rT1hc1JP87gfsMCIbJ/BH6LxvOwn76xg3JGb2eWzsNsOoIceoDqXE8OuS546seSH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3CH/Zwsgzkkjr4dGifRlGFwcWOKV+PmNDGYOmJVgkBmDN93A/iqUVf3 X-MS-Exchange-AntiSpam-MessageData: aSIM+0h2awb/Mh5aphHArVHabPh5NtHgdaWbyvrcdbDIRcYlwSlNgaEeXHlqzlVcVwbtvlGR5f7L8OY+FOMTwJPYejY2Q5nxD0s3wlI4xLq0Muf57avF5kRJssC9EpFeLPBGDYK/GONX+ag3slKHgg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 855527a7-ea94-4da7-7436-08d8dd9b901d X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2021 16:52:28.5451 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HK2APC01FT034.eop-APC01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2APC01HT124 Subject: [dpdk-dev] [PATCH] net/pcap: fix fd leak on uninit 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" pcap fd was opend when vdev probed, but not closed when vdev removed. Fixes: c956caa6eabf ("pcap: support port hotplug") Cc: stable@dpdk.org Signed-off-by: Tengfei Zhang --- drivers/net/pcap/rte_eth_pcap.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c index 90f5d75ea..49b9a1f44 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -621,9 +621,11 @@ eth_dev_stop(struct rte_eth_dev *dev) /* Special iface case. Single pcap is open and shared between tx/rx. */ if (internals->single_iface) { - pcap_close(pp->tx_pcap[0]); - pp->tx_pcap[0] = NULL; - pp->rx_pcap[0] = NULL; + if (pp->tx_pcap[0] != NULL) { + pcap_close(pp->tx_pcap[0]); + pp->tx_pcap[0] = NULL; + pp->rx_pcap[0] = NULL; + } goto status_down; } @@ -755,6 +757,8 @@ eth_dev_close(struct rte_eth_dev *dev) PMD_LOG(INFO, "Closing pcap ethdev on NUMA socket %d", rte_socket_id()); + eth_dev_stop(dev); + rte_free(dev->process_private); if (rte_eal_process_type() != RTE_PROC_PRIMARY) -- 2.25.1