Skip to contentSkip to conversation

net/sched: act_ct: Fix leak of ct zone template on replace

PATCH In review Paul Blakey 2 participants 2 messages Mar 18, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/sched: act_ct: Fix leak of ct zone template on replace

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 b57dc7c13ea9 ("net/sched: Introduce action ct")
---
 net/sched/act_ct.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/act_ct.c +1 -1
index f685c0d..41114b4 100644
@@ -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);
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Paul Blakey <[email protected]>
Date: Wed, 18 Mar 2020 12:50:33 +0200

Quoted 10 lines

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 b57dc7c13ea9 ("net/sched: Introduce action ct")

Applied and queued up for -stable.