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 34E36A00C5 for ; Wed, 3 Aug 2022 12:10:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2CCE040A7E; Wed, 3 Aug 2022 12:10:23 +0200 (CEST) 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 1329540141 for ; Wed, 3 Aug 2022 12:10:22 +0200 (CEST) Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) (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 D43B43F12B for ; Wed, 3 Aug 2022 10:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1659521421; bh=40aLn1g8UcukKoaTtF0ZZa6Jrleyk92CBmn+TgEVn3Y=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=reClXpIEHkVKDqG3NwccNBqgaImYBraNCp7MacgfpJz9TK9Ju9sYSGSjpfRjQDH2O rcyqWzVzzL468iXqBXDZMfXAZAOF/gQ8qNPRK9o7/I/jiHoxwy8YWBrHDGfaodxkcu Y5tbJOar9wD/pHoexe5DKUvwjwBiDO69kZMERolMf9zX0Hpj32cGm2U8mGsj0KB4wF UJPgm1gM0qfAO1dsS3mevmriL54dSRoNU4pNCsXdhfZlnhOmi/W55GzeUMF+uITKHU IsLm79PD00+FDZSvPLBWFX7LjGTsp4BCxGvkKme7pOVCms9CQuzRoJEWpw+7FRq/Nb xbOuDzwOVl3vA== Received: by mail-lf1-f69.google.com with SMTP id z1-20020a0565120c0100b0048ab2910b13so4901785lfu.23 for ; Wed, 03 Aug 2022 03:10:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=40aLn1g8UcukKoaTtF0ZZa6Jrleyk92CBmn+TgEVn3Y=; b=xSJLxKD3bQ/rawUF0L5uaUAm6nHtHq/4GkjB/SHeRFBsGI2qmID/cYYxPuAIQkwlOd P+koyMC4oIBDeGUqyYOrtwuxyVh3yFIApyftrRUEYBGTgIJypjXo/W/dL1JbVBw1l91s AoRTZg7KWcX7fI9x6GCzUqqISaEXtbMdEks1fQAB/+iom0LSAOoWc1bSc9TQP746wgfR C8dBXIYsIwzQmtxrSSyHPKZlEYR6haAFpCJ/KI59vWZ19UN1vNvsf82CVA+t5XtSRxwV iCnXhesBYPVe7j7Ti0LE1K6mM17FGJbTV4XR0FIOY/cSBB4mZnPbXoaoD1LG5gb+/jMF Lotw== X-Gm-Message-State: AJIora8kCloImrYeods0EHSovIhoV7WwEq1ZARHP4TNUgNY7mHVzM5Fu Wn3Fvgtf+veQMhlFjj8TkGNdvGL9tzCDCP/XTX5nwi6HXnl4JBmIuAdnV8vDzmcayrc/jVLRvnG G1OMdDiwiuI2UAl59/7oHNziTjAfFlNGpKa/Eq35K X-Received: by 2002:a05:651c:1581:b0:255:48d1:fdae with SMTP id h1-20020a05651c158100b0025548d1fdaemr7916514ljq.286.1659521421215; Wed, 03 Aug 2022 03:10:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tb9/BTHi17UiUuijPr05esqd7Q9nqrQ5UvdQc6kWUpwzQtOPiJIAWbMgmWmI3rAH3PXVoaoC1lUWpGwW3PYEk= X-Received: by 2002:a05:651c:1581:b0:255:48d1:fdae with SMTP id h1-20020a05651c158100b0025548d1fdaemr7916508ljq.286.1659521420983; Wed, 03 Aug 2022 03:10:20 -0700 (PDT) MIME-Version: 1.0 References: <20220720030507.207811-1-ke1x.zhang@intel.com> In-Reply-To: <20220720030507.207811-1-ke1x.zhang@intel.com> From: Christian Ehrhardt Date: Wed, 3 Aug 2022 12:09:54 +0200 Message-ID: Subject: Re: [PATCH 19.11] app/testpmd: fix multicast address pool leak To: Ke Zhang Cc: stable@dpdk.org, Yuying Zhang , Ferruh Yigit Content-Type: text/plain; charset="UTF-8" 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 On Wed, Jul 20, 2022 at 5:13 AM Ke Zhang wrote: > > [ upstream commit "68629be3a622ee53cd5b40c8447ae9b083ff3f6c" ] Thank you, your patch was too late in regard to my original deadline and I was then unavailable for a while. In the meantime more patches came in and I do not want to waste any of them just because they were late. Sadly your patch didn't apply due to others landing as well. But the only conflict it had seemed easy and I have resolved it, please consider having a look at https://github.com/cpaelzer/dpdk-stable-queue/tree/19.11 if you agree. > A multicast address pool is allocated for a port when > using mcast_addr testpmd commands. > > When closing a port or stopping testpmd, this pool was > not freed, resulting in a leak. > This issue has been caught using ASan. > > Free this pool when closing the port. > > Error info as following: > ERROR: LeakSanitizer: detected memory leaksDirect leak of > 192 byte(s) > 0 0x7f6a2e0aeffe in __interceptor_realloc > (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) > 1 0x565361eb340f in mcast_addr_pool_extend > ../app/test-pmd/config.c:5162 > 2 0x565361eb3556 in mcast_addr_pool_append > ../app/test-pmd/config.c:5180 > 3 0x565361eb3aae in mcast_addr_add > ../app/test-pmd/config.c:5243 > > Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") > Cc: stable@dpdk.org > > Signed-off-by: Ke Zhang > Acked-by: Yuying Zhang > Acked-by: Ferruh Yigit > --- > app/test-pmd/config.c | 19 +++++++++++++++++++ > app/test-pmd/testpmd.c | 1 + > app/test-pmd/testpmd.h | 1 + > 3 files changed, 21 insertions(+) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 3eefc90bf..995fd3b38 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -3996,6 +3996,25 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) > sizeof(struct rte_ether_addr) * (port->mc_addr_nb - addr_idx)); > } > > +int > +mcast_addr_pool_destroy(portid_t port_id) > +{ > + struct rte_port *port; > + > + if (port_id_is_invalid(port_id, ENABLED_WARN) || > + port_id == (portid_t)RTE_PORT_ALL) > + return -EINVAL; > + port = &ports[port_id]; > + > + if (port->mc_addr_nb != 0) { > + /* free the pool of multicast addresses. */ > + free(port->mc_addr_pool); > + port->mc_addr_pool = NULL; > + port->mc_addr_nb = 0; > + } > + return 0; > +} > + > static int > eth_port_multicast_addr_list_set(portid_t port_id) > { > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index cb59c85c8..523f48c97 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -2612,6 +2612,7 @@ close_port(portid_t pid) > > if (port->flow_list) > port_flow_flush(pi); > + mcast_addr_pool_destroy(pi); > rte_eth_dev_close(pi); > > remove_invalid_ports(); > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index 244b0c710..ac18bc394 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -733,6 +733,7 @@ int port_flow_create(portid_t port_id, > const struct rte_flow_attr *attr, > const struct rte_flow_item *pattern, > const struct rte_flow_action *actions); > +int mcast_addr_pool_destroy(portid_t port_id); > int port_flow_destroy(portid_t port_id, uint32_t n, const uint32_t *rule); > int port_flow_flush(portid_t port_id); > int port_flow_query(portid_t port_id, uint32_t rule, > -- > 2.25.1 > -- Christian Ehrhardt Senior Staff Engineer, Ubuntu Server Canonical Ltd