Skip to contentSkip to conversation

net_sched: check cops->tcf_block in tc_bind_tclass()

PATCH Applied Cong Wang 2 participants 2 messages Sep 8, 2019 – Sep 10, 2019

Subsystems (3)
lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 net_sched: check cops->tcf_block in tc_bind_tclass()

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 [email protected]
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>
---
 net/sched/sch_api.c | 2 ++
 1 file changed, 2 insertions(+)
net/sched/sch_api.c +2 -0
index 04faee7ccbce..1047825d9f48 100644
@@ -1920,6 +1920,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;
Signature · 1 line
2.21.0
maintainer Applied
#1 lore raw

From: Cong Wang <[email protected]>
Date: Sun, 8 Sep 2019 12:11:23 -0700

Quoted 11 lines

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 [email protected]
Cc Jamal Hadi Salim <[email protected]>
Cc Jiri Pirko <[email protected]>

Applied.