]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net_sched: fix a crash in tc_new_tfilter()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 27 Sep 2018 20:42:19 +0000 (13:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 09:18:10 +0000 (10:18 +0100)
commitf9ff09e266ca70c801b9911280f6ae64c9183d85
treec601f0aff5961df1a749c15f366556e7d9d01ef0
parentd7b6d5f0e9c681c9390d25af8d23606e12fbc5f8
net_sched: fix a crash in tc_new_tfilter()

commit 460b360104d51552a57f39e54b2589c9fd7fa0b3 upstream.

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: e368fdb61d8e ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/cls_api.c