summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2019-09-08 12:11:23 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-10-01 08:26:12 +0200
commit07f7ec87b5f6e1c9d954e967e971efa696ecb018 (patch)
treeb0143063d4abdb702db9f67a1a742468347c9100 /net
parent90b0761c1b81a78b0d6cdb85a5a83e98d7e8494c (diff)
downloadlinux-stable-07f7ec87b5f6e1c9d954e967e971efa696ecb018.tar.gz
linux-stable-07f7ec87b5f6e1c9d954e967e971efa696ecb018.tar.bz2
linux-stable-07f7ec87b5f6e1c9d954e967e971efa696ecb018.zip
net_sched: check cops->tcf_block in tc_bind_tclass()
[ Upstream commit 8b142a00edcf8422ca48b8de88d286efb500cb53 ] At least sch_red and sch_tbf don't implement ->tcf_block() while still have a non-zero tc "class". Instead of adding nop implementations to each of such qdisc's, we can just relax the check of cops->tcf_block() in tc_bind_tclass(). They don't support TC filter anyway. Reported-by: syzbot+21b29db13c065852f64b@syzkaller.appspotmail.com Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/sched/sch_api.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index be7cd140b2a3..b06cc5e50412 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1831,6 +1831,8 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid,
cl = cops->find(q, portid);
if (!cl)
return;
+ if (!cops->tcf_block)
+ return;
block = cops->tcf_block(q, cl, NULL);
if (!block)
return;