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 5F4C9A0C41 for ; Tue, 30 Nov 2021 17:37:09 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5AB5C41186; Tue, 30 Nov 2021 17:37:09 +0100 (CET) Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by mails.dpdk.org (Postfix) with ESMTP id C1D19410F7 for ; Tue, 30 Nov 2021 17:37:08 +0100 (CET) Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 63A464000F for ; Tue, 30 Nov 2021 16:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1638290228; bh=EkxeiOzdC3LfS3bM9dGDgrPMdmEJwcJ+ONaRJLV9GVU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZNzBDjdnAOyYrr+FoBsfz5ze9aDiBeC1MKTKjTBiBvd9u+qNwzvYIMFF54m/DveYf rqowxIRvu+mlBU5atQwE8YRVjfvtfh3xqrrkq3wpSqN+zoKYP0F9io7TbBlyuz6cxz Rk9U5ROooxthqRrzTu4ytIjS1anky2DuQRdRBOLCe2tu1tx/jJ7a5zbwjw1AFHQ2qO aEDRs/njsUeUFO7LY3vnoUudLHmFqtaEtPsGNWCtPieSJrAG18Hs0Jl7RwXK1rpReN TpSvVGkC1swIPY+aQ0ohoZb/7T/bk1rlJ8qiGDXPHUrrmdwONV0MBLuEntnLrCm6vP +PTdC5DJF0/8Q== Received: by mail-ed1-f71.google.com with SMTP id i19-20020a05640242d300b003e7d13ebeedso17440817edc.7 for ; Tue, 30 Nov 2021 08:37:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EkxeiOzdC3LfS3bM9dGDgrPMdmEJwcJ+ONaRJLV9GVU=; b=JwU5yzZgglsYSkTUDp4k17/v2XYmEzIyyRnohUHTT9ykoaRSK08Uv9Lp0IBOsFhV6Y 7lI2i9IKLJS4AtEipq43DV53ujOKAmiZky4BXjlG4s/+1M1ryBGeAGScmBvLRc5QFt76 rl19Ud5OddfAXjY5q7s7uHgT5OBmNQJRRqaJbAQVrzb+kj3Zpv9a9cOiRpWz1BlkoD3P Sgpp1AvmdvAcRMJ3w1hw3FGdXm4Nm3QkbGt5UeBU5ic+znHmpiEeNfExGadKIMk89jwj IuP9AsDlsxAfku0o++QQClpF8BAGKln2HCVNTLE7bUUn9W2593FGyKnjNzfFD8v1ZjlI 4PNg== X-Gm-Message-State: AOAM531uGXFA2QQL2Idj34dgLH/BKjoUzRSdALIUFJWBA5vYv9dYDRJj fVomNeAhjsqpPAJVYm7btL8KpemKPyX7GH1ZTKYH917kXKxzrsFPKPu4Io6Bt/sdwS1R4KKTmqD CWafrJSOuW7s37OgNp+0W1aps X-Received: by 2002:a17:907:6da2:: with SMTP id sb34mr137277ejc.509.1638290228079; Tue, 30 Nov 2021 08:37:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxyv7B3gGTzAEA0csiUb8i4U9bu7YDXbkboRxA6n3NdwwGH69kfPMy1+M9Lge7ILFaA4Gj2g== X-Received: by 2002:a17:907:6da2:: with SMTP id sb34mr137260ejc.509.1638290227893; Tue, 30 Nov 2021 08:37:07 -0800 (PST) Received: from localhost.localdomain ([2001:67c:1560:8007::aac:c4ad]) by smtp.gmail.com with ESMTPSA id dy4sm11442914edb.92.2021.11.30.08.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Nov 2021 08:37:07 -0800 (PST) From: christian.ehrhardt@canonical.com To: Qiming Chen Cc: Ferruh Yigit , dpdk stable Subject: patch 'net/pcap: fix resource leakage on port probe' has been queued to stable release 19.11.11 Date: Tue, 30 Nov 2021 17:33:44 +0100 Message-Id: <20211130163605.2460997-20-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> References: <20211130163605.2460997-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 19.11.11 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before December 10th 2021. 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/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/a9c743e39971b254f27745fbff6892e43e355eee Thanks. Christian Ehrhardt --- >From a9c743e39971b254f27745fbff6892e43e355eee 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 [ 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 9ac0a11ffb..619868c510 100644 --- a/drivers/net/pcap/rte_eth_pcap.c +++ b/drivers/net/pcap/rte_eth_pcap.c @@ -1336,6 +1336,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) { @@ -1549,6 +1576,9 @@ create_eth: free_kvlist: rte_kvargs_free(kvlist); + if (ret < 0) + eth_release_pcaps(&pcaps, &dumpers, devargs_all.single_iface); + return ret; } -- 2.34.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-11-30 16:50:07.285103065 +0100 +++ 0020-net-pcap-fix-resource-leakage-on-port-probe.patch 2021-11-30 16:50:05.558871827 +0100 @@ -1 +1 @@ -From da0280b3a34c6f67f7e558fcc86c3110816fea28 Mon Sep 17 00:00:00 2001 +From a9c743e39971b254f27745fbff6892e43e355eee Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit da0280b3a34c6f67f7e558fcc86c3110816fea28 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org @@ -19 +20 @@ - drivers/net/pcap/pcap_ethdev.c | 30 ++++++++++++++++++++++++++++++ + drivers/net/pcap/rte_eth_pcap.c | 30 ++++++++++++++++++++++++++++++ @@ -22,5 +23,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 9ac0a11ffb..619868c510 100644 +--- a/drivers/net/pcap/rte_eth_pcap.c ++++ b/drivers/net/pcap/rte_eth_pcap.c +@@ -1336,6 +1336,33 @@ eth_from_pcaps(struct rte_vdev_device *vdev, @@ -60 +61 @@ -@@ -1582,6 +1609,9 @@ create_eth: +@@ -1549,6 +1576,9 @@ create_eth: