From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ACB23C1F22; Tue, 21 Jul 2026 22:48:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674137; cv=none; b=IALZkkxD3X+NX4IPet9qP+N1h/dOa5EU9z35CjrCxN/1PMC7CfhWIUtB0hhz+MPJD+R4gc0bmco75hbJ1Uk7Y5KsMabpcDUfadd3lqnc31xQvaYqMmxM5+opMkn/QhDyemWcnvLFAIDwaubRNx9UySlzRtgylbRcfM8DjaZwI+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784674137; c=relaxed/simple; bh=qE/mG/aaD5JaR922boBX0rRDPUsbj3a9cyY4Ol3A+aw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y2qW0Aslir9f2jcZ1Pnx7VC2TO4sr9ZXbLUb+JUQQlFofoFW5TZitUeEAjOQ0DmvJ9tPGmAy6KQzajOINGL1d4/En8+gB/OtZ81N921EWdR4qHoo1gqz6ga1KWvp7prpArs1lVdoWJUm2hKlhyzFQBiqZc7gLhyGBrOTx//24Jc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RgreKiun; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RgreKiun" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E01FB1F000E9; Tue, 21 Jul 2026 22:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784674136; bh=zzE49wu/UTVhyFJaWyEUI9+ehVmx75adzVOFuw5Xo4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RgreKiun2ymDAW5OtYCStnOlqv7H26dpelWKp7LfskAmjzychLKCjG3NrZokvY8Uo W67AryDAMMoT15s9LEqnP7quES7G0Kzc72gqNExgZrOZT81tTU6EdvvcPFX0lCK9oO nRGqYBx0pKzOmzqWv7LGlOnfkGulkFL2xgYw5Vxc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Li RongQing , Simon Horman , Tariq Toukan , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 427/699] net/mlx5: Fix L3 tunnel entropy refcount leak Date: Tue, 21 Jul 2026 17:23:06 +0200 Message-ID: <20260721152405.325028548@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152355.667394603@linuxfoundation.org> References: <20260721152355.667394603@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Li RongQing [ Upstream commit c914307e1d41c2cb7bcdcbfde4cd2f214f6aa027 ] mlx5_tun_entropy_refcount_inc() counts both VXLAN and L2-to-L3 tunnel reformat entries as entropy-enabling users. The matching decrement path only handled VXLAN, leaving L2-to-L3 tunnel entries counted after release. Handle MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL in mlx5_tun_entropy_refcount_dec() as well so the enabling entry refcount remains balanced. Fixes: f828ca6a2fb6 ("net/mlx5e: Add support for hw encapsulation of MPLS over UDP") Signed-off-by: Li RongQing Reviewed-by: Simon Horman Reviewed-by: Tariq Toukan Link: https://patch.msgid.link/20260703141423.1723-1-lirongqing@baidu.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c index e042e092407939..1642ff7915ff84 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c @@ -177,7 +177,8 @@ void mlx5_tun_entropy_refcount_dec(struct mlx5_tun_entropy *tun_entropy, int reformat_type) { mutex_lock(&tun_entropy->lock); - if (reformat_type == MLX5_REFORMAT_TYPE_L2_TO_VXLAN) + if (reformat_type == MLX5_REFORMAT_TYPE_L2_TO_VXLAN || + reformat_type == MLX5_REFORMAT_TYPE_L2_TO_L3_TUNNEL) tun_entropy->num_enabling_entries--; else if (reformat_type == MLX5_REFORMAT_TYPE_L2_TO_NVGRE && --tun_entropy->num_disabling_entries == 0) -- 2.53.0