Skip to contentSkip to conversation

net: sched: cbq: create block for q->link.block

PATCH RESEND In review Jiri Pirko 4 participants 4 messages Nov 27, 2017 – Nov 28, 2017

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH RESEND 1/1 net: sched: cbq: create block for q->link.block

From: Jiri Pirko <[email protected]>

q->link.block is not initialized, that leads to EINVAL when one tries to add filter there. So initialize it properly.

This can be reproduced by:

$ tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 rate 1000Mbit bandwidth 1000Mbit
$ tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 0 0x00 flowid 1:1
Fixes 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
---
 net/sched/sch_cbq.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/sched/sch_cbq.c +8 -1
index 6361be7..525eb3a 100644
@@ -1158,9 +1158,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 	if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
 		return -EINVAL;
 
+	err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
+	if (err)
+		goto put_rtab;
+
 	err = qdisc_class_hash_init(&q->clhash);
 	if (err < 0)
-		goto put_rtab;
+		goto put_block;
 
 	q->link.sibling = &q->link;
 	q->link.common.classid = sch->handle;
@@ -1194,6 +1198,9 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 	cbq_addprio(q, &q->link);
 	return 0;
 
+put_block:
+	tcf_block_put(q->link.block);
+
 put_rtab:
 	qdisc_put_rtab(q->link.R_tab);
 	return err;
Signature · 1 line
2.9.5
Acked-by on v1 1/1
#1 lore raw
Quoted 37 lines · Jiri Pirko

From: Jiri Pirko <[email protected]>

q->link.block is not initialized, that leads to EINVAL when one tries to add filter there. So initialize it properly.

This can be reproduced by:

$ tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 rate 1000Mbit bandwidth 1000Mbit
$ tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 0 0x00 flowid 1:1
Fixes 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
---
  net/sched/sch_cbq.c | 9 ++++++++-
  1 file changed, 8 insertions(+), 1 deletion(-)
net/sched/sch_cbq.c +5 -1
index 6361be7..525eb3a 100644
@@ -1158,9 +1158,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
  	if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
  		return -EINVAL;
 
+	err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
+	if (err)
+		goto put_rtab;
+
  	err = qdisc_class_hash_init(&q->clhash);
  	if (err < 0)
-		goto put_rtab;
+		goto put_block;
 
  	q->link.sibling = &q->link;
  	q->link.common.classid = sch->handle;

net/sched/sch_cbq.c static int cbq_init(struct Qdisc *sch, struct nlattr *opt) · line 1206

Quoted 9 lines
net/sched/sch_cbq.c +3 -0
@@ -1194,6 +1198,9 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
  	cbq_addprio(q, &q->link);
  	return 0;
 
+put_block:
+	tcf_block_put(q->link.block);
+
  put_rtab:
  	qdisc_put_rtab(q->link.R_tab);
  	return err;

I was about to submit a similar patch...

Reviewed-by on v1 1/1
#2 lore raw
In reply to Jiri Pirko
Quoted 38 lines · Jiri Pirko

From: Jiri Pirko <[email protected]>

q->link.block is not initialized, that leads to EINVAL when one tries to add filter there. So initialize it properly.

This can be reproduced by:

$ tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 rate 1000Mbit bandwidth 1000Mbit
$ tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 0 0x00 flowid 1:1
Fixes 6529eaba33f0 ("net: sched: introduce tcf block infractructure")
---
 net/sched/sch_cbq.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/sched/sch_cbq.c +5 -1
index 6361be7..525eb3a 100644
@@ -1158,9 +1158,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 	if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
 		return -EINVAL;
 
+	err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
+	if (err)
+		goto put_rtab;
+
 	err = qdisc_class_hash_init(&q->clhash);
 	if (err < 0)
-		goto put_rtab;
+		goto put_block;
 
 	q->link.sibling = &q->link;
 	q->link.common.classid = sch->handle;

net/sched/sch_cbq.c static int cbq_init(struct Qdisc *sch, struct nlattr *opt) · line 1206

Quoted 9 lines
net/sched/sch_cbq.c +3 -0
@@ -1194,6 +1198,9 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 	cbq_addprio(q, &q->link);
 	return 0;
 
+put_block:
+	tcf_block_put(q->link.block);
+
 put_rtab:
 	qdisc_put_rtab(q->link.R_tab);
 	return err;

Thanks for quick fix.

maintainer
#3 lore raw
In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>
Date: Mon, 27 Nov 2017 18:37:21 +0100

Quoted 5 lines

From: Jiri Pirko <[email protected]>

q->link.block is not initialized, that leads to EINVAL when one tries to add filter there. So initialize it properly.

Quoted 8 lines

This can be reproduced by:

$ tc qdisc add dev eth0 root handle 1: cbq avpkt 1000 rate 1000Mbit bandwidth 1000Mbit
$ tc filter add dev eth0 parent 1: protocol ip prio 100 u32 match ip protocol 0 0x00 flowid 1:1
Fixes 6529eaba33f0 ("net: sched: introduce tcf block infractructure")

Applied and queued up for -stable, thanks Jiri.