Skip to content

Commit 09f979d

Browse files
GoodLuck612kuba-moo
authored andcommitted
net: mvpp2: cls: Fix memory leak in mvpp2_ethtool_cls_rule_ins()
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: f4f1ba1 ("net: mvpp2: cls: Report an error for unsupported flow types") Signed-off-by: Zilin Guan <zilin@seu.edu.cn> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/20260123065716.2248324-1-zilin@seu.edu.cn Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 944c614 commit 09f979d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *port,
13891389
efs->rule.flow_type = mvpp2_cls_ethtool_flow_to_type(info->fs.flow_type);
13901390
if (efs->rule.flow_type < 0) {
13911391
ret = efs->rule.flow_type;
1392-
goto clean_rule;
1392+
goto clean_eth_rule;
13931393
}
13941394

13951395
ret = mvpp2_cls_rfs_parse_rule(&efs->rule);

0 commit comments

Comments
 (0)