From nobody Mon Feb 9 16:54:11 2026 Received: from mail-m49197.qiye.163.com (mail-m49197.qiye.163.com [45.254.49.197]) (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 CDC2348BD3D; Wed, 21 Jan 2026 14:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769004379; cv=none; b=gHhW5kR7QH1KXIPyUChckP5WguYISHCxn04PvBzugLvypXH+VNqTorEWAsPRhekWKNawMM2azL1GfpL0ZuxxYjbcicbdi8j2oggylPsJAPTX3driVEZ/huVv4qu9/iYzz1YFKO/gIq/nsVr04AJP5H+zAIah65sorG/juB03mqA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769004379; c=relaxed/simple; bh=Bbqkh8JN5jmjA5Asp+FwpQUw5osRxfgCiN/yUh3vJ8M=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=LhmKWbyoTI6rPYPUJdeG1NOXnUCbCtP6WNhoK3gwLIWdKTmtYIauVuE9ykKTIt91ZLrcylkxQ4+hWyjMqGou7Q5wbZFrOcmhRBbJta3zkYOIKjwQrPtQJgHQYOXqg3Fs/xfI3+P1zaD6BCMVdLF3RdYvr6kau4KZz/hgJ4t7r2k= 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=KvMBb6Qy; arc=none smtp.client-ip=45.254.49.197 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="KvMBb6Qy" Received: from LAPTOP-N070L597.localdomain (unknown [58.215.202.202]) by smtp.qiye.163.com (Hmail) with ESMTP id 3176abc2f; Wed, 21 Jan 2026 22:06:04 +0800 (GMT+08:00) From: Zilin Guan To: marcin.s.wojtas@gmail.com Cc: linux@armlinux.org.uk, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jianhao.xu@seu.edu.cn, Zilin Guan Subject: [PATCH net] net: mvpp2: cls: Fix memory leak in mvpp2_ethtool_cls_rule_ins() Date: Wed, 21 Jan 2026 14:06:00 +0000 Message-Id: <20260121140600.3903164-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: 0a9be0e06fa003a1kunm41fcbfcf41f7 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWS1ZQUlXWQ8JGhUIEh9ZQVkZSBpJVkxPSkkZS0oeQ0xCSlYeHw5VEwETFhoSFy QUDg9ZV1kYEgtZQVlOQ1VJSk5VSUtJVUlLSVlXWRYaDxIVHRRZQVlPS0hVSktJSE5DQ1VKS0tVS1 kG DKIM-Signature: a=rsa-sha256; b=KvMBb6QyNQI0DPCGNcFoKW9vFPTAWGgv2Yor7I1BbnmJPjjZNL5uOFEsrLuDz9e+5cHB5Oq6SdkeY630IhLQFbI26Q0WVl7myp+glyju/DDyojmuu0vuGZ3s88V1wItBG4zKIRhPZNWb2jvtqDZ74sJZzRSUrwk0d4Pn41F0wBo=; c=relaxed/relaxed; s=default; d=seu.edu.cn; v=1; bh=VNofmuJtGeaPKWffFcA0QTzcO09Jad/jcFimA2a0lss=; h=date:mime-version:subject:message-id:from; Content-Type: text/plain; charset="utf-8" In mvpp2_ethtool_cls_rule_ins(), the ethtool_rule is allocated by ethtool_rx_flow_rule_create(). If the subsequent conversion to flow type fails, the function jumps to the clean_rule label. However, the clean_rule label only frees efs, skipping the cleanup of ethtool_rule, which leads to a memory leak. Fix this by jumping to the clean_eth_rule label, which properly calls ethtool_rx_flow_rule_destroy() before freeing efs. Compile tested only. Issue found using a prototype static analysis tool and code review. Fixes: f4f1ba18195d ("net: mvpp2: cls: Report an error for unsupported flow= types") Signed-off-by: Zilin Guan --- drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/e= thernet/marvell/mvpp2/mvpp2_cls.c index 44b201817d94..c116da7d7f18 100644 --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c @@ -1389,7 +1389,7 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *por= t, efs->rule.flow_type =3D mvpp2_cls_ethtool_flow_to_type(info->fs.flow_type= ); if (efs->rule.flow_type < 0) { ret =3D efs->rule.flow_type; - goto clean_rule; + goto clean_eth_rule; } =20 ret =3D mvpp2_cls_rfs_parse_rule(&efs->rule); --=20 2.34.1