lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 18 Dec 2018 23:08:25 -0800
From:   xiangxia.m.yue@...il.com
To:     netdev@...r.kernel.org, xiyou.wangcong@...il.com
Cc:     Tonghao Zhang <xiangxia.m.yue@...il.com>
Subject: [PATCH net-next] net: sched: add checks for tbf classid

From: Tonghao Zhang <xiangxia.m.yue@...il.com>

tbf has only one qdisc class. When adding qdisc for it,
we should check the classid, otherwise the parentid:1
classid is available, no matter what classid tc specified.

$ tc qdisc add dev eth1 handle 10: root tbf rate 0.5mbit burst 5kb latency 70ms
$ tc class show dev eth1
class tbf 10:1 parent 10:

$ tc qdisc add dev eth1 parent 10:2 handle 20: pfifo_fast
or
$ tc qdisc add dev eth1 parent 10:0 handle 20: pfifo_fast
$ tc class show dev eth1
class tbf 10:1 parent 10: leaf 20:

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
---
 net/sched/sch_tbf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 942dcca..df636b1 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -505,12 +505,18 @@ static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg)
 {
 	struct tbf_sched_data *q = qdisc_priv(sch);
-	return q->qdisc;
+	if (arg == 1)
+		return q->qdisc;
+
+	return NULL;
 }
 
 static unsigned long tbf_find(struct Qdisc *sch, u32 classid)
 {
-	return 1;
+	if (TC_H_MIN(classid) == 1)
+		return 1;
+
+	return 0;
 }
 
 static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker)
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ