From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A41F3425CFC; Wed, 4 Feb 2026 15:24:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218646; cv=none; b=Yn/l6iWdXiwOOyl/5E7i7s9zk+NW2w4m81mvij3GWdi47AjRKO+d7i33TXLqy3i259WFqwALfLpi9PddTBm7MHVaRQRSVQgBi4Ve6nWXG62Erkfny4LM4psSGKhIQfJS/4YMsa1oegEF3QvzJeDVSK+oCVss3qEkbZ9LKlYxxvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770218646; c=relaxed/simple; bh=Rin6q/Q90LJma+z9SzDmm889DNKy2n2g7PwMn9cQZac=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mXheJVnZHUTuJoVuVB1J+xyY71zbbkeALiCUbW33ytAvNaxvY2SIH7JQpGNdm+5xrEXOkpvkMGemdncO57G5WTE+iG7O1UlrYkqOSFoPs/fwR35AUgg4zmdvc68KqqpGjOq6S4l93HRjDcCjGVsM4D2LaHQ82GNHA137+Ow8T7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rEKVswLC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rEKVswLC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F05B4C4CEF7; Wed, 4 Feb 2026 15:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770218646; bh=Rin6q/Q90LJma+z9SzDmm889DNKy2n2g7PwMn9cQZac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEKVswLCY12o7F3P3uhjIqyrezh4cAFc9NNWWOdUnIBBhXvr1JJ/CWVRr+9guewnb tu4KFSxGCSA4DvIMQKbeIGGd8n8GYKUzeY6ndTLPgWJBF3td+3IM3OBegLSO62LVni dKX9c+qp1NBEnXFWG/5pYSBqgJ/UczlsKMgEmQh8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zilin Guan , Maxime Chevallier , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 09/87] net: mvpp2: cls: Fix memory leak in mvpp2_ethtool_cls_rule_ins() Date: Wed, 4 Feb 2026 15:40:07 +0100 Message-ID: <20260204143847.248532592@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143846.906385641@linuxfoundation.org> References: <20260204143846.906385641@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zilin Guan [ Upstream commit 09f979d1f312627b31d2ee1e46f9692e442610cd ] 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 Reviewed-by: Maxime Chevallier Link: https://patch.msgid.link/20260123065716.2248324-1-zilin@seu.edu.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- 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/ethernet/marvell/mvpp2/mvpp2_cls.c index 8ed83fb988624..155bc41ffce65 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 *port, efs->rule.flow_type = mvpp2_cls_ethtool_flow_to_type(info->fs.flow_type); if (efs->rule.flow_type < 0) { ret = efs->rule.flow_type; - goto clean_rule; + goto clean_eth_rule; } ret = mvpp2_cls_rfs_parse_rule(&efs->rule); -- 2.51.0