1
0
Fork 0

net_sched: fix a crash in tc_new_tfilter()

When tcf_block_find() fails, it already rollbacks the qdisc refcnt,
so its caller doesn't need to clean up this again. Avoid calling
qdisc_put() again by resetting qdisc to NULL for callers.

Reported-by: syzbot+37b8770e6d5a8220a039@syzkaller.appspotmail.com
Fixes: e368fdb61d ("net: sched: use Qdisc rcu API instead of relying on rtnl lock")
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.1
Cong Wang 2018-09-27 13:42:19 -07:00 committed by David S. Miller
parent a1fa80802c
commit 460b360104
1 changed files with 3 additions and 1 deletions

View File

@ -717,8 +717,10 @@ static struct tcf_block *tcf_block_find(struct net *net, struct Qdisc **q,
errout_rcu:
rcu_read_unlock();
errout_qdisc:
if (*q)
if (*q) {
qdisc_put(*q);
*q = NULL;
}
return ERR_PTR(err);
}