aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2017-11-27 12:37:21 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-28 16:04:26 -0500
commitd51aae68b142f48232257e96ce317db25445418d (patch)
tree137141a72c691f4a5a286fa263473acd1715c2c4
parent0195a21079c077abfb475a56830b06b37424982a (diff)
net: sched: cbq: create block for q->link.block
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 Reported-by: Jaroslav Aster <jaster@redhat.com> Reported-by: Ivan Vecera <ivecera@redhat.com> Fixes: 6529eaba33f0 ("net: sched: introduce tcf block infractructure") Signed-off-by: Jiri Pirko <jiri@mellanox.com> Acked-by: Eelco Chaudron <echaudro@redhat.com> Reviewed-by: Ivan Vecera <ivecera@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/sch_cbq.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 6361be7881f1..525eb3a6d625 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1158,9 +1158,13 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
1158 if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL) 1158 if ((q->link.R_tab = qdisc_get_rtab(r, tb[TCA_CBQ_RTAB])) == NULL)
1159 return -EINVAL; 1159 return -EINVAL;
1160 1160
1161 err = tcf_block_get(&q->link.block, &q->link.filter_list, sch);
1162 if (err)
1163 goto put_rtab;
1164
1161 err = qdisc_class_hash_init(&q->clhash); 1165 err = qdisc_class_hash_init(&q->clhash);
1162 if (err < 0) 1166 if (err < 0)
1163 goto put_rtab; 1167 goto put_block;
1164 1168
1165 q->link.sibling = &q->link; 1169 q->link.sibling = &q->link;
1166 q->link.common.classid = sch->handle; 1170 q->link.common.classid = sch->handle;
@@ -1194,6 +1198,9 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
1194 cbq_addprio(q, &q->link); 1198 cbq_addprio(q, &q->link);
1195 return 0; 1199 return 0;
1196 1200
1201put_block:
1202 tcf_block_put(q->link.block);
1203
1197put_rtab: 1204put_rtab:
1198 qdisc_put_rtab(q->link.R_tab); 1205 qdisc_put_rtab(q->link.R_tab);
1199 return err; 1206 return err;