From nobody Mon Feb 9 10:34:33 2026 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (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 B762D43634B; Tue, 20 Jan 2026 13:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768916811; cv=none; b=I9auLNeuyOavKxrazCwtrKtoaAkm60SRIaYS7sgy9zY3Ppoj76xNFHtUcxIwiR9NWqO90c3oBgTONn/alDJrugw1s20HVbn22VmX/oR7V6l3oUH0OyfWLPJ6UysH+RGVzGNSr687Ar+NG8rWlsaO1j7LADKRimTOCXyZT7N3rk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768916811; c=relaxed/simple; bh=opBE8oYKWgsx5SoZfybPFosKnVlsqN/RSAY3ODW+Dk0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AH4HUkpekXoMRbuzRhLKRw4Dva9iyLh8YpoenVaIRIKRyeSL1JZ3+fGcwbNOp+dYXBzZFM9dOHkQKo7AMwmr+NdPkscy2OMYTjzSjFYvgnV5J+2Nn46N+AnFJ36BdSFZpptt6OcldgWVUrCfGWlVOktCf1O4zuAuYMqvihhMxqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn; spf=pass smtp.mailfrom=seu.edu.cn; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b=NOS8B8h0; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=seu.edu.cn Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=seu.edu.cn header.i=@seu.edu.cn header.b="NOS8B8h0" Received: from LAPTOP-N070L597.localdomain (unknown [221.228.238.82]) by smtp.qiye.163.com (Hmail) with ESMTP id 31510a4d2; Tue, 20 Jan 2026 21:46:42 +0800 (GMT+08:00) From: Zilin Guan To: saeedm@nvidia.com Cc: leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, Zilin Guan Subject: [PATCH net] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup() Date: Tue, 20 Jan 2026 13:46:40 +0000 Message-Id: <20260120134640.2717808-1-zilin@seu.edu.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Tid: 0a9bdba85bcb03a1kunme7053fe626af57 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVlCSBgaVksYTENNQ0MYGRkdSFYeHw5VEwETFhoSFy QUDg9ZV1kYEgtZQVlJSUpVSUlDVUlIQ1VDSVlXWRYaDxIVHRRZQVlPS0hVSktJSE5DQ1VKS0tVS1 kG DKIM-Signature: a=rsa-sha256; b=NOS8B8h00nIdFLiLhtaaUQmhUogIq5/vgE/bU1Cn9Bradnx1zrzZwAE3pe//c8IKFYnfyEG8Op5ZbqQyZjoU7L2PL30sal9Z9Kt45T0dn0sfE9mi6BhPg4iPXB7SRUhx5vs3UFbuDzikdo/ZDA+ZOVtjZOIjRu/oH7Fv59oMFtM=; c=relaxed/relaxed; s=default; d=seu.edu.cn; v=1; bh=gFZdwxzfuWXOZeNw1Eankdonx/w8/suQYqCCjfJeHzw=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" In esw_acl_ingress_lgcy_setup(), if esw_acl_table_create() fails, the function returns directly without releasing the previously created counter, leading to a memory leak. Fix this by jumping to the out label instead of returning directly, which aligns with the error handling logic of other paths in this function. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: 07bab9502641 ("net/mlx5: E-Switch, Refactor eswitch ingress acl code= s") Signed-off-by: Zilin Guan Reviewed-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c= b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c index 1c37098e09ea..49a637829c59 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c @@ -188,7 +188,7 @@ int esw_acl_ingress_lgcy_setup(struct mlx5_eswitch *esw, if (IS_ERR(vport->ingress.acl)) { err =3D PTR_ERR(vport->ingress.acl); vport->ingress.acl =3D NULL; - return err; + goto out; } =20 err =3D esw_acl_ingress_lgcy_groups_create(esw, vport); --=20 2.34.1