net: mvpp2: cls: Fix leaked ethtool_rx_flow_rule [Linux 5.2]

net: mvpp2: cls: Fix leaked ethtool_rx_flow_rule [Linux 5.2]

This Linux kernel change "net: mvpp2: cls: Fix leaked ethtool_rx_flow_rule" is included in the Linux 5.2 release. This change is authored by Maxime Chevallier <maxime.chevallier [at]> on Thu May 23 10:47:24 2019 +0200. The commit for this change in Linux stable tree is 3f6f7a1 (patch).

net: mvpp2: cls: Fix leaked ethtool_rx_flow_rule

The flow_rule is only used when configuring the classification tables,
and should be free'd once we're done using it. The current code only
frees it in the error path.

Fixes: 90b509b39ac9 ("net: mvpp2: cls: Add Classification offload support")
Signed-off-by: Maxime Chevallier <>
Signed-off-by: David S. Miller <>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
index d046f7a..a57d17a 100644
--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
+++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c
@@ -1271,6 +1271,9 @@ int mvpp2_ethtool_cls_rule_ins(struct mvpp2_port *port,
    if (ret)
        goto clean_eth_rule;

+   ethtool_rx_flow_rule_destroy(ethtool_rule);
+   efs->rule.flow = NULL;
    memcpy(&efs->rxnfc, info, sizeof(*info));
    port->rfs_rules[efs->rule.loc] = efs;

Leave a Reply

Your email address will not be published. Required fields are marked *