patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Ke Zhang <ke1x.zhang@intel.com>
Cc: Yuying Zhang <yuying.zhang@intel.com>,
	Ferruh Yigit <ferruh.yigit@xilinx.com>,
	dpdk stable <stable@dpdk.org>
Subject: patch 'app/testpmd: fix multicast address pool leak' has been queued to stable release 21.11.2
Date: Mon, 20 Jun 2022 10:47:40 +0100	[thread overview]
Message-ID: <20220620094752.1027299-7-ktraynor@redhat.com> (raw)
In-Reply-To: <20220620094752.1027299-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to stable release 21.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/23/22. 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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/a9062fa2fc4e005036475a9161fe0ba38d896564

Thanks.

Kevin

---
From a9062fa2fc4e005036475a9161fe0ba38d896564 Mon Sep 17 00:00:00 2001
From: Ke Zhang <ke1x.zhang@intel.com>
Date: Fri, 25 Mar 2022 08:35:55 +0000
Subject: [PATCH] app/testpmd: fix multicast address pool leak

[ upstream commit 68629be3a622ee53cd5b40c8447ae9b083ff3f6c ]

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")

Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
---
 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 3855a6809f..f8c058f204 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5292,4 +5292,23 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t 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 1c415b0209..214763d65b 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3239,4 +3239,5 @@ close_port(portid_t pid)
 
 		if (is_proc_primary()) {
+			mcast_addr_pool_destroy(pi);
 			port_flow_flush(pi);
 			port_flex_item_flush(pi);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 42db6b56df..04bc7ffbc2 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -918,4 +918,5 @@ int port_action_handle_query(portid_t port_id, uint32_t id);
 void update_age_action_context(const struct rte_flow_action *actions,
 		     struct port_flow *pf);
+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);
-- 
2.34.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-06-20 10:46:27.940808817 +0100
+++ 0007-app-testpmd-fix-multicast-address-pool-leak.patch	2022-06-20 10:46:27.782146829 +0100
@@ -1 +1 @@
-From 68629be3a622ee53cd5b40c8447ae9b083ff3f6c Mon Sep 17 00:00:00 2001
+From a9062fa2fc4e005036475a9161fe0ba38d896564 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 68629be3a622ee53cd5b40c8447ae9b083ff3f6c ]
+
@@ -28 +29,0 @@
-Cc: stable@dpdk.org
@@ -40 +41 @@
-index 72d2606d19..d6caa1f0b2 100644
+index 3855a6809f..f8c058f204 100644
@@ -43 +44 @@
-@@ -6071,4 +6071,23 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx)
+@@ -5292,4 +5292,23 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx)
@@ -68 +69 @@
-index 4d51eb9576..9d6175e9a7 100644
+index 1c415b0209..214763d65b 100644
@@ -71 +72 @@
-@@ -3238,4 +3238,5 @@ close_port(portid_t pid)
+@@ -3239,4 +3239,5 @@ close_port(portid_t pid)
@@ -78 +79 @@
-index 6693813dda..dd34b025e6 100644
+index 42db6b56df..04bc7ffbc2 100644
@@ -81 +82 @@
-@@ -992,4 +992,5 @@ int port_action_handle_query(portid_t port_id, uint32_t id);
+@@ -918,4 +918,5 @@ int port_action_handle_query(portid_t port_id, uint32_t id);


  parent reply	other threads:[~2022-06-20  9:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  9:47 patch 'raw/ifpga: remove virtual devices on close' " Kevin Traynor
2022-06-20  9:47 ` patch 'raw/ifpga: unregister interrupt " Kevin Traynor
2022-06-20  9:47 ` patch 'bus/fslmc: fix VFIO setup' " Kevin Traynor
2022-06-20  9:47 ` patch 'doc: fix formatting and link in BPF library guide' " Kevin Traynor
2022-06-20  9:47 ` patch 'dma/idxd: fix error code for PCI device commands' " Kevin Traynor
2022-06-20  9:47 ` patch 'app/testpmd: fix packet segment allocation' " Kevin Traynor
2022-06-20  9:47 ` Kevin Traynor [this message]
2022-06-20  9:47 ` patch 'net/failsafe: fix device freeing' " Kevin Traynor
2022-06-20  9:47 ` patch 'net/tap: " Kevin Traynor
2022-06-20  9:47 ` patch 'kni: use dedicated function to set random MAC address' " Kevin Traynor
2022-06-20  9:47 ` patch 'kni: use dedicated function to set " Kevin Traynor
2022-06-20  9:47 ` patch 'crypto/ipsec_mb: fix build with GCC 12' " Kevin Traynor
2022-06-20  9:47 ` patch 'net/ena: " Kevin Traynor
2022-06-20  9:47 ` patch 'net/enetfec: " Kevin Traynor
2022-06-20  9:47 ` patch 'net/ice: " Kevin Traynor
2022-06-20  9:47 ` patch 'vdpa/ifc: " Kevin Traynor
2022-06-20  9:47 ` patch 'app/flow-perf: " Kevin Traynor
2022-06-20  9:47 ` patch 'dma/skeleton: fix index returned when no memcpy completed' " Kevin Traynor
2022-06-20  9:47 ` patch 'dma/hisilicon: fix includes in header file' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220620094752.1027299-7-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=ferruh.yigit@xilinx.com \
    --cc=ke1x.zhang@intel.com \
    --cc=stable@dpdk.org \
    --cc=yuying.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).