net: mvpp2: cls: Fix leaked ethtool_rx_flow_rule
authorMaxime Chevallier <maxime.chevallier@bootlin.com>
Thu, 23 May 2019 08:47:24 +0000 (10:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 16:13:00 +0000 (09:13 -0700)
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 <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mvpp2/mvpp2_cls.c

index d046f7a1dcf5a556cc3ebc83af057a339f830409..a57d17ab91f04749fa090bcc371956bbf45c6f9e 100644 (file)
@@ -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;
        port->n_rfs_rules++;