Commit 47fd92f5 authored by Hiroaki SHIMODA's avatar Hiroaki SHIMODA Committed by David S. Miller

net_sched: act: Delete estimator in error path.

Some action modules free struct tcf_common in their error path
while estimator is still active. This results in est_timer()
dereference freed memory.
Add gen_kill_estimator() in ipt, pedit and simple action.
Signed-off-by: default avatarHiroaki SHIMODA <shimoda.hiroaki@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9871f1ad
...@@ -185,7 +185,12 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est, ...@@ -185,7 +185,12 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est,
err2: err2:
kfree(tname); kfree(tname);
err1: err1:
kfree(pc); if (ret == ACT_P_CREATED) {
if (est)
gen_kill_estimator(&pc->tcfc_bstats,
&pc->tcfc_rate_est);
kfree_rcu(pc, tcfc_rcu);
}
return err; return err;
} }
......
...@@ -74,7 +74,10 @@ static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est, ...@@ -74,7 +74,10 @@ static int tcf_pedit_init(struct nlattr *nla, struct nlattr *est,
p = to_pedit(pc); p = to_pedit(pc);
keys = kmalloc(ksize, GFP_KERNEL); keys = kmalloc(ksize, GFP_KERNEL);
if (keys == NULL) { if (keys == NULL) {
kfree(pc); if (est)
gen_kill_estimator(&pc->tcfc_bstats,
&pc->tcfc_rate_est);
kfree_rcu(pc, tcfc_rcu);
return -ENOMEM; return -ENOMEM;
} }
ret = ACT_P_CREATED; ret = ACT_P_CREATED;
......
...@@ -131,7 +131,10 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est, ...@@ -131,7 +131,10 @@ static int tcf_simp_init(struct nlattr *nla, struct nlattr *est,
d = to_defact(pc); d = to_defact(pc);
ret = alloc_defdata(d, defdata); ret = alloc_defdata(d, defdata);
if (ret < 0) { if (ret < 0) {
kfree(pc); if (est)
gen_kill_estimator(&pc->tcfc_bstats,
&pc->tcfc_rate_est);
kfree_rcu(pc, tcfc_rcu);
return ret; return ret;
} }
d->tcf_action = parm->action; d->tcf_action = parm->action;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment