]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/sched: act_ct: Fix leak of ct zone template on replace
authorPaul Blakey <paulb@mellanox.com>
Wed, 18 Mar 2020 10:50:33 +0000 (12:50 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Mar 2020 23:37:06 +0000 (16:37 -0700)
Currently, on replace, the previous action instance params
is swapped with a newly allocated params. The old params is
only freed (via kfree_rcu), without releasing the allocated
ct zone template related to it.

Call tcf_ct_params_free (via call_rcu) for the old params,
so it will release it.

Fixes: 213cbf44d25b ("net/sched: Introduce action ct")
Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_ct.c

index f685c0d737086d5a0317f87cbfeb890e2f4f2a9b..41114b4631611dd8f0a5efa565527e8dd649ff74 100644 (file)
@@ -739,7 +739,7 @@ static int tcf_ct_init(struct net *net, struct nlattr *nla,
        if (goto_ch)
                tcf_chain_put_by_act(goto_ch);
        if (params)
-               kfree_rcu(params, rcu);
+               call_rcu(&params->rcu, tcf_ct_params_free);
        if (res == ACT_P_CREATED)
                tcf_idr_insert(tn, *a);