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 DED2DA0543 for ; Tue, 21 Jun 2022 10:12:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 69F8B42B70; Tue, 21 Jun 2022 10:12:38 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2083.outbound.protection.outlook.com [40.107.102.83]) by mails.dpdk.org (Postfix) with ESMTP id 9D08F42B98 for ; Tue, 21 Jun 2022 10:12:36 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qx+ohz2Kd2dMVQaoob4H6bFB1t2zeYv384O37KoWRGvFdNkas0dxYmNdaTOyiHcrIZcEXGuDtY7uIYRXXB9asQa4z4bpbdo7clghfYFoLpNh7FRUQT6W0Nrt1sa2FaaajD+lLaXvK+7mC5IrCIbEPIkUph6N3C7IhRFFZUQJqfsg7S2SzFNyTJ63bCPfLVFCwy06cgfiQJPYeO5WZGavNBT/Mgb4ykR2JU67l0emz04ZE1uQz75y2/nwwZ/Wup/zUJHcmUy8MVRO8LAnwxGPtliPmNZgwrjXnFXd1WlDXzdVAg7UBRKS1TP+LHPgNnKfDr99XLKBXpjr0+8LcrzrVw== 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=8/rHhVd1fJCSwIRXpxgoQAGkBJ8Ts/NBdvnZorSQESI=; b=hihlQB0cwajUZN60lszfhALkKEn/0L34Nf/RN+IxAgo8e1uyYhxCwV5pI6U/WZI/RXFInvZg7K43f3Tdq2qL0X3J2k1bn29BLH9+V0eeJmsrUTsLzyyyQMgzki2kZ1tuwmKb2yc/4ce+hr5hmp3xSZJ9Adm1O8iLyhYPG3OiPyuYusMZ9eb5C4EDd5oYhoBN/JSw+iIL3XSLeJCbP9hn5+sy4pp1qfqvbl/0Z/Nas6bk29r4oCWtSOyj8ZmWMgUlqEzUmLy41xzo/+VoHdmn6eqmF4GIweqBCHhMJwvnkF88E9MgvwRTCFXufCDvllyUvd53ruOfh38CsRP2WXjSsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=xilinx.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject 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=8/rHhVd1fJCSwIRXpxgoQAGkBJ8Ts/NBdvnZorSQESI=; b=EZRrZGdeFjI1b/Is0OGCnAC6uH/YCj6f7bEIXdP3FuKUwFwInqrxGCL424aXmPequbvxp1Fd35krWjeaB/aMf2McvAYGbb3I3vxHkjsICNphGUnw6G54aVjM4tHDFIexyiarorwViO6C2PBMt1s+43/8OoI/P7KmeCx57mdyBS5yD/nOfNYEhjMuXFuCbeHsP4tT7uO0bae+K1BjTQkYWpkna5f2kQDQLw4nrLl7G39WP86/1PHrAsChZGetWwwTCGXJ3FvVfWqzlT2uG2c2evIf3j1m0EVKTgvhqR48CGwR2FlscJDnBhtfGiMDMlpMuNQnEGf8mbG7ToaH0lPBTA== Received: from MWHPR2001CA0007.namprd20.prod.outlook.com (2603:10b6:301:15::17) by BN7PR12MB2692.namprd12.prod.outlook.com (2603:10b6:408:2a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.20; Tue, 21 Jun 2022 08:12:34 +0000 Received: from CO1NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:301:15:cafe::8a) by MWHPR2001CA0007.outlook.office365.com (2603:10b6:301:15::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.22 via Frontend Transport; Tue, 21 Jun 2022 08:12:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT063.mail.protection.outlook.com (10.13.175.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5353.14 via Frontend Transport; Tue, 21 Jun 2022 08:12:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Tue, 21 Jun 2022 08:12:33 +0000 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 21 Jun 2022 01:12:32 -0700 From: Xueming Li To: Ke Zhang CC: Yuying Zhang , Ferruh Yigit , dpdk stable Subject: patch 'app/testpmd: fix multicast address pool leak' has been queued to stable release 20.11.6 Date: Tue, 21 Jun 2022 11:02:55 +0300 Message-ID: <20220621080301.2315720-110-xuemingl@nvidia.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220621080301.2315720-1-xuemingl@nvidia.com> References: <20220621080301.2315720-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4788c4cc-5f9a-4303-bc7b-08da535dcc0c X-MS-TrafficTypeDiagnostic: BN7PR12MB2692:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TkuvunIcyWpNEFzmyCDvOsymc0tOUftjUKJSCL24l4KDcMsvlSEh9+ey2bL579pytWh29Tm2LcQeqbC8ZMcLCNc0fAVNBCwy1RRjlEErzAW8je4PFjUcDZh2KFZlGeP9dZfR0zyfwN+5QFiVF0yZaNG5P6byqtJgP3UyqydVSwozWCUYcQhz7sGzpNxqnvrQmvRfxUVQuIuIHm7hYDiPOYXJnDEIUvUzXfYE98lguqdEoD7WSiHd4pc6BfsnZJYeKl67RCWmhLl5Cx2/pOI7dxqN2YhxjcOY4h50y8bygthv+zkXnteDOeLN5z5zjyQxbiOcNlnrfHzVswczhWlFS1vLkjv+HGN1rSMSgrLCrTSKZ6VtIW26lG4zVduMxdq8RjExSpF+cjFu7Jc+CHxvA3w80Md0hGta56eJe1aT7seJvwujJkQyFa9/eIc7P1ODzfW10e7Gb+7QvOJFsa3LcOdC+SOjUMjQ/HwwU+vncADd3ZYVVsWZqlApmYRgd5vbAXfoJ5xtU6ep8CoaOGS6Li9AFw4wZrZk/XXyHsyvTFTwI7Om1nodBsIEVzzA4LJG58aXajlB0kFaJSNfZNdtHEENm0v4J+5KytL8XTzK0vZvjQ0T+eB2yDPT9AtMujUUMWsEls96Obm/745CsHf7yqlHKjRDsVVhreHx+KzK5xYMbXTws0To77TEdT0cDHYe2pCZTAhI5vr4T0wHmyYWUDuPXPCtbuI5BYKztCb2aidbzG0QvSOA8io3IQsVqSACFl5oWjRJHeKeKlcgPjve305qUDcjOzkrG8HJPODsPEZ2tX2TGqgpbIithTo3355zNElQ49gk+J7ih/bnrqoqJk/f+qpNNp8uFBn2V9e+UqM= X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230016)(4636009)(346002)(136003)(396003)(39860400002)(376002)(36840700001)(46966006)(40470700004)(83380400001)(6666004)(6286002)(41300700001)(426003)(26005)(7696005)(53546011)(336012)(478600001)(8936002)(40460700003)(16526019)(47076005)(966005)(86362001)(1076003)(2616005)(316002)(4326008)(2906002)(6916009)(54906003)(82740400003)(186003)(356005)(36860700001)(81166007)(82310400005)(36756003)(70586007)(70206006)(8676002)(55016003)(5660300002)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2022 08:12:34.5703 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4788c4cc-5f9a-4303-bc7b-08da535dcc0c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR12MB2692 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 20.11.6 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/steevenlee/dpdk This queued commit can be viewed at: https://github.com/steevenlee/dpdk/commit/59d08006aa2a9596efd300fb54e033f07167b65a Thanks. Xueming Li --- >From 59d08006aa2a9596efd300fb54e033f07167b65a Mon Sep 17 00:00:00 2001 From: Ke Zhang Date: Fri, 25 Mar 2022 08:35:55 +0000 Subject: [PATCH] app/testpmd: fix multicast address pool leak Cc: Xueming Li [ 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 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 ee2f560b61..d24fb7763e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -5088,6 +5088,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 6ecb032c81..ae7a7ddd3e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2834,6 +2834,7 @@ close_port(portid_t pid) continue; } + mcast_addr_pool_destroy(pi); port_flow_flush(pi); rte_eth_dev_close(pi); } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 5fa898eb96..6ccdff43f1 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -838,6 +838,7 @@ int port_flow_create(portid_t port_id, int port_shared_action_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); int port_flow_dump(portid_t port_id, const char *file_name); -- 2.35.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-06-21 15:37:54.061779618 +0800 +++ 0109-app-testpmd-fix-multicast-address-pool-leak.patch 2022-06-21 15:37:49.234451950 +0800 @@ -1 +1 @@ -From 68629be3a622ee53cd5b40c8447ae9b083ff3f6c Mon Sep 17 00:00:00 2001 +From 59d08006aa2a9596efd300fb54e033f07167b65a Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 68629be3a622ee53cd5b40c8447ae9b083ff3f6c ] @@ -28 +30,0 @@ -Cc: stable@dpdk.org @@ -40 +42 @@ -index 72d2606d19..d6caa1f0b2 100644 +index ee2f560b61..d24fb7763e 100644 @@ -43 +45 @@ -@@ -6070,6 +6070,25 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) +@@ -5088,6 +5088,25 @@ mcast_addr_pool_remove(struct rte_port *port, uint32_t addr_idx) @@ -70 +72 @@ -index 4d51eb9576..9d6175e9a7 100644 +index 6ecb032c81..ae7a7ddd3e 100644 @@ -73 +75,2 @@ -@@ -3237,6 +3237,7 @@ close_port(portid_t pid) +@@ -2834,6 +2834,7 @@ close_port(portid_t pid) + continue; @@ -76,5 +79,4 @@ - if (is_proc_primary()) { -+ mcast_addr_pool_destroy(pi); - port_flow_flush(pi); - port_flex_item_flush(pi); - port_action_handle_flush(pi); ++ mcast_addr_pool_destroy(pi); + port_flow_flush(pi); + rte_eth_dev_close(pi); + } @@ -82 +84 @@ -index 6693813dda..dd34b025e6 100644 +index 5fa898eb96..6ccdff43f1 100644 @@ -85,2 +87,2 @@ -@@ -991,6 +991,7 @@ int port_flow_create(portid_t port_id, - int port_action_handle_query(portid_t port_id, uint32_t id); +@@ -838,6 +838,7 @@ int port_flow_create(portid_t port_id, + int port_shared_action_query(portid_t port_id, uint32_t id); @@ -92 +94 @@ - int port_flow_dump(portid_t port_id, bool dump_all, + int port_flow_dump(portid_t port_id, const char *file_name);