mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
net_sched: fix a use-after-free in tc_ctl_tfilter()
When tcf_destroy() returns true, tp could be already destroyed,
we should not use tp->next after that.
For long term, we probably should move tp list to list_head.
Fixes: 1e052be69d ("net_sched: destroy proto tp when all filters are gone")
Cc: Jamal Hadi Salim <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Acked-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
1006da19ea
commit
d744318574
1 changed files with 3 additions and 4 deletions
|
|
@ -308,12 +308,11 @@ replay:
|
|||
case RTM_DELTFILTER:
|
||||
err = tp->ops->delete(tp, fh);
|
||||
if (err == 0) {
|
||||
tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER);
|
||||
if (tcf_destroy(tp, false)) {
|
||||
struct tcf_proto *next = rtnl_dereference(tp->next);
|
||||
struct tcf_proto *next = rtnl_dereference(tp->next);
|
||||
|
||||
tfilter_notify(net, skb, n, tp, fh, RTM_DELTFILTER);
|
||||
if (tcf_destroy(tp, false))
|
||||
RCU_INIT_POINTER(*back, next);
|
||||
}
|
||||
}
|
||||
goto errout;
|
||||
case RTM_GETTFILTER:
|
||||
|
|
|
|||
Loading…
Reference in a new issue