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 C7EFA46BAF for ; Fri, 18 Jul 2025 21:34:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C050A40E49; Fri, 18 Jul 2025 21:34:31 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 905A440E44 for ; Fri, 18 Jul 2025 21:34:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752867270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8VlhWcLOwFK+UR0KdT6vq4NY3SWegLKHMLDiikNJCPE=; b=UjIl9jz5BEngJIgyw3AGzPzrWv86w5GI9XVRogLaMW5p9FjKiu9izvvG/nBezNu3e3zAqD pThjG2BBESxH2nZ5qMWQfztujkym7atJ1RzG96PAxGH51V/C+g9IXI88y/gmZGFNfPCCXH CFmp1MTfz8Gv9z7M4R0w3EBv/wzJZEA= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-519-F2GuY1h8M3Gsh43lkSWjRg-1; Fri, 18 Jul 2025 15:34:26 -0400 X-MC-Unique: F2GuY1h8M3Gsh43lkSWjRg-1 X-Mimecast-MFC-AGG-ID: F2GuY1h8M3Gsh43lkSWjRg_1752867266 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D9D041800C32; Fri, 18 Jul 2025 19:34:25 +0000 (UTC) Received: from rh.redhat.com (unknown [10.44.32.40]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 930FA180045B; Fri, 18 Jul 2025 19:34:24 +0000 (UTC) From: Kevin Traynor To: Dengdui Huang Cc: dpdk stable Subject: patch 'net/hns3: fix memory leak on failure' has been queued to stable release 24.11.3 Date: Fri, 18 Jul 2025 20:29:36 +0100 Message-ID: <20250718193247.1008129-42-ktraynor@redhat.com> In-Reply-To: <20250718193247.1008129-1-ktraynor@redhat.com> References: <20250718193247.1008129-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5e8mv1sDnCXigofvd-m4B0jZowPPqzxah7nAyGkiBvg_1752867266 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 24.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/23/25. 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/c9d54054fd05c4d52972102a4eae0ea2c2029199 Thanks. Kevin --- >From c9d54054fd05c4d52972102a4eae0ea2c2029199 Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Tue, 8 Apr 2025 16:30:55 +0800 Subject: [PATCH] net/hns3: fix memory leak on failure [ upstream commit 1c27385dcef1384a1a10edd86bb843b06547b161 ] When the hns3_dfx_reg_fetch_data() function returns from processing failure, cmd_descs is not freed, which leads to leakage. This patch fit it. By the way, this patch uses calloc to apply for heap memory instead of hugepage memory. Fixes: ef1fbd355451 ("net/hns3: add more registers to dump") Signed-off-by: Dengdui Huang --- drivers/net/hns3/hns3_regs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c index 8a6ddbfe8c..5c74f9ae2e 100644 --- a/drivers/net/hns3/hns3_regs.c +++ b/drivers/net/hns3/hns3_regs.c @@ -1271,5 +1271,5 @@ hns3_get_dfx_regs(struct hns3_hw *hw, struct rte_dev_reg_info *regs, uint32_t mo max_bd_num = RTE_MAX(bd_num_list[i], max_bd_num); - cmd_descs = rte_zmalloc(NULL, sizeof(*cmd_descs) * max_bd_num, 0); + cmd_descs = calloc(max_bd_num, sizeof(*cmd_descs)); if (cmd_descs == NULL) return -ENOMEM; @@ -1291,4 +1291,5 @@ hns3_get_dfx_regs(struct hns3_hw *hw, struct rte_dev_reg_info *regs, uint32_t mo hns3_err(hw, "Query register number differ from the list for module %s!", hns3_get_name_by_module(i)); + free(cmd_descs); return -EINVAL; } @@ -1297,5 +1298,5 @@ hns3_get_dfx_regs(struct hns3_hw *hw, struct rte_dev_reg_info *regs, uint32_t mo data += regs_num; } - rte_free(cmd_descs); + free(cmd_descs); return ret; -- 2.50.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-07-18 20:29:12.581290357 +0100 +++ 0042-net-hns3-fix-memory-leak-on-failure.patch 2025-07-18 20:29:10.918907294 +0100 @@ -1 +1 @@ -From 1c27385dcef1384a1a10edd86bb843b06547b161 Mon Sep 17 00:00:00 2001 +From c9d54054fd05c4d52972102a4eae0ea2c2029199 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 1c27385dcef1384a1a10edd86bb843b06547b161 ] + @@ -14 +15,0 @@ -Cc: stable@dpdk.org