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 E109048B59 for ; Thu, 20 Nov 2025 13:45:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD41D402DD; Thu, 20 Nov 2025 13:45:56 +0100 (CET) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 38D8D40262 for ; Thu, 20 Nov 2025 13:45:55 +0100 (CET) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47774d3536dso6618825e9.0 for ; Thu, 20 Nov 2025 04:45:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763642755; x=1764247555; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K5iv57STm4KdAsL8xQmZd6+1kzF6pr76rHKq4dH/AYE=; b=QZyqzaJthdaYS2/PCPzsXp7nf4lH9y5m+3Ss8nP91cvHgj5F89mWtBDKyteaoOQJxl /Ox6Gm0rNq1VDjZYmRhCUGNzdgU5yYwQQdsapRcZW9CLLsZqf9AKDXIT7q9sGAui1u4a 7dZw/hv4+Xw44hUixJ1GqzqtXcy0UgCPB9gdhzH+Xr5rdOeD62eOFHv4UX4kIS6SgT5S qvbixHk/5kYQEExSGyVoOXjaCk8l1ynRxCVRzhs2HiYO6gcKmpLwdNgLzbq/mvqNLa1O WhQM3QyfqWu8Io5lCGqI/EHaj0DDSJ2kWiYzLKTxXDGPLJn3j+xhmrDqFEdsUP8BgY++ FVmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763642755; x=1764247555; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=K5iv57STm4KdAsL8xQmZd6+1kzF6pr76rHKq4dH/AYE=; b=Swyp+Ws1jXgebT5Yjkl8c7QoJ/3v+UfczrwNmBBkyvYiR8LSIrObMFnDq7zHP26q26 huMzVDvPo+jP2Cp8IY6E9yCB+nAguyfPATwHoTYRtCAH7nOjhjxk7ngkFJ9QreixUMC6 skcQRAQ+J+lF/6ZJ5ThGOaV33CTeWsk1zYEhr/4yJj1sjFrx9SFV8nsCOBIbccSwqXgF El38mW0RAKr/Xk047vgIxeZCkLbxVF99bzPZMo6jzQJhEh3Mu1d2X+7VphfqdTDH0D5w jPAbGMSnFDvaB8bKy3rV2aSKqcD5Gbp9YDBtYt9kCmhsZoYvyC/3fvWA5fpkiRNLJ3YD z8KQ== X-Forwarded-Encrypted: i=1; AJvYcCVNen37Re3NIQT3MDwcgIf19ZBKZnghcsbq/av4G9+oDa+J/e2A5RXRMqh7b84m6ty0andB2Oo=@dpdk.org X-Gm-Message-State: AOJu0YxwNmk00zYJrY1aWQFxGyUW7TDotv+AXxp+3ApL8VYvTW6VWSmJ 8ZattLbDg8O8088rtmb6t7saDjiW1xKpA88YI87aFMwYzLCH/BCLOVlW X-Gm-Gg: ASbGncvuB1HPTzeaCu1adrGtnF8EttOu6Wf5oft0AdDtBzrNCXOKhmFC1wsYl6VENxC T71OrCPuh0bsilFyRBwZFuM7CXf4YGWfePSST4oN6gSOnLvNbZir5wvRXow9SnYxRpkrZ1YZ0Fi tl9tt9osq8pQtzi4cMEWuXu30FcDXadrEgmiRvLlIB+WTT6IJFLV7NDrET2fta3qd2+ciTGHDDJ qzLfCsudSmJWW+NyFdF7dE8iFHbKu0JW6r4cCqs1Ztkt5KsqpWRnMeRfguqpJviFaflBixQk+vn T91mQYm5a3zwFaUo+Uc5ize0j8U07vF1gZVFuaM6zAj3RC3rAFXw5eLW8PwJU1URzjdYgMpXbQE HN65ENemZKbx1Zq3YU4TlOnP5gzeqrv2LVRVAeHStqQU8J0XH2aAtqNFmuklk5iqb3VnWg7FcxL sA/QPa3+3byCqcLjUW X-Google-Smtp-Source: AGHT+IET0IfISUHXIAC0Nyo3s4VLi/NHO1rJyM8e92gUtXOSxyUlP9mg+VUZrleiPIc9uSZyuPoKoA== X-Received: by 2002:a05:600d:17:b0:477:9cec:c83e with SMTP id 5b1f17b1804b1-477b9ea35b6mr19225095e9.1.1763642754450; Thu, 20 Nov 2025 04:45:54 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f372:8d1a:399f:e8a2]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-42cb7fd8baesm5302970f8f.39.2025.11.20.04.45.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 04:45:53 -0800 (PST) From: luca.boccassi@gmail.com To: Nupur Uttarwar Cc: Dariusz Sosnowski , dpdk stable Subject: patch 'net/mlx5/hws: fix buddy memory allocation' has been queued to stable release 22.11.11 Date: Thu, 20 Nov 2025 12:44:47 +0000 Message-ID: <20251120124514.757933-15-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251120124514.757933-1-luca.boccassi@gmail.com> References: <20251112165308.1618107-49-luca.boccassi@gmail.com> <20251120124514.757933-1-luca.boccassi@gmail.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 22.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 11/22/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/3d4cdeff7fe3ebe14e475147c4ba9be84bb5571c Thanks. Luca Boccassi --- >From 3d4cdeff7fe3ebe14e475147c4ba9be84bb5571c Mon Sep 17 00:00:00 2001 From: Nupur Uttarwar Date: Wed, 12 Nov 2025 09:47:39 +0200 Subject: [PATCH] net/mlx5/hws: fix buddy memory allocation [ upstream commit 8d1fe10768d2749d00ceb7124866c61d31164380 ] `buddy` was erroroneously declared as static. When multiple threads call this routine, they set the same static variable corrupting pool data and can cause potential double free when releasing resources. Fixes: b4dd7bcb0dcb ("net/mlx5/hws: add pool and buddy") Signed-off-by: Nupur Uttarwar Acked-by: Dariusz Sosnowski --- .mailmap | 1 + drivers/net/mlx5/hws/mlx5dr_buddy.c | 1 + drivers/net/mlx5/hws/mlx5dr_pool.c | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index e540177a1f..e831062a09 100644 --- a/.mailmap +++ b/.mailmap @@ -1033,6 +1033,7 @@ Nitzan Weller Noa Ezra Nobuhiro Miki Norbert Ciosek +Nupur Uttarwar Odi Assli Ofer Dagan Ognjen Joldzic diff --git a/drivers/net/mlx5/hws/mlx5dr_buddy.c b/drivers/net/mlx5/hws/mlx5dr_buddy.c index cde4f54f66..c4a558ba5e 100644 --- a/drivers/net/mlx5/hws/mlx5dr_buddy.c +++ b/drivers/net/mlx5/hws/mlx5dr_buddy.c @@ -147,6 +147,7 @@ void mlx5dr_buddy_cleanup(struct mlx5dr_buddy_mem *buddy) simple_free(buddy->num_free); simple_free(buddy->bits); + simple_free(buddy); } int mlx5dr_buddy_alloc_mem(struct mlx5dr_buddy_mem *buddy, int order) diff --git a/drivers/net/mlx5/hws/mlx5dr_pool.c b/drivers/net/mlx5/hws/mlx5dr_pool.c index af6a5c743b..98e2436d1f 100644 --- a/drivers/net/mlx5/hws/mlx5dr_pool.c +++ b/drivers/net/mlx5/hws/mlx5dr_pool.c @@ -167,7 +167,7 @@ static struct mlx5dr_buddy_mem * mlx5dr_pool_buddy_get_next_buddy(struct mlx5dr_pool *pool, int idx, uint32_t order, bool *is_new_buddy) { - static struct mlx5dr_buddy_mem *buddy; + struct mlx5dr_buddy_mem *buddy; uint32_t new_buddy_size; buddy = pool->db.buddy_manager->buddies[idx]; @@ -271,7 +271,6 @@ static void mlx5dr_pool_buddy_db_uninit(struct mlx5dr_pool *pool) buddy = pool->db.buddy_manager->buddies[i]; if (buddy) { mlx5dr_buddy_cleanup(buddy); - simple_free(buddy); pool->db.buddy_manager->buddies[i] = NULL; } } -- 2.47.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-11-20 12:44:13.324110874 +0000 +++ 0015-net-mlx5-hws-fix-buddy-memory-allocation.patch 2025-11-20 12:44:12.790088272 +0000 @@ -1 +1 @@ -From 8d1fe10768d2749d00ceb7124866c61d31164380 Mon Sep 17 00:00:00 2001 +From 3d4cdeff7fe3ebe14e475147c4ba9be84bb5571c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8d1fe10768d2749d00ceb7124866c61d31164380 ] + @@ -22 +24 @@ -index f9c5622e5d..efc66fd48c 100644 +index e540177a1f..e831062a09 100644 @@ -25 +27,2 @@ -@@ -1180,6 +1180,7 @@ Noa Ezra +@@ -1033,6 +1033,7 @@ Nitzan Weller + Noa Ezra @@ -28 +30,0 @@ - Norbert Zulinski @@ -34 +36 @@ -index 394ca71217..abfbdf1be5 100644 +index cde4f54f66..c4a558ba5e 100644 @@ -46 +48 @@ -index 8e3718ac42..e383027d3e 100644 +index af6a5c743b..98e2436d1f 100644