* [patch net resend] net: sched: cbq: create block for q->link.block
@ 2017-11-27 17:37 Jiri Pirko
2017-11-28 9:16 ` Eelco Chaudron
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jiri Pirko @ 2017-11-27 17:37 UTC (permalink / raw)
To: netdev; +Cc: davem, jhs, xiyou.wangcong, mlxsw, jaster, ivecera
From: Jiri Pirko <jiri@mellanox.com>
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>
---
net/sched/sch_cbq.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index 6361be7..525eb3a 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)
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;
--
2.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch net resend] net: sched: cbq: create block for q->link.block
2017-11-27 17:37 [patch net resend] net: sched: cbq: create block for q->link.block Jiri Pirko
@ 2017-11-28 9:16 ` Eelco Chaudron
2017-11-28 10:14 ` Ivan Vecera
2017-11-28 21:05 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Eelco Chaudron @ 2017-11-28 9:16 UTC (permalink / raw)
To: Jiri Pirko, netdev; +Cc: davem, jhs, xiyou.wangcong, mlxsw, jaster, ivecera
On 27/11/17 18:37, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> 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>
> ---
> net/sched/sch_cbq.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
> index 6361be7..525eb3a 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)
> 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;
I was about to submit a similar patch...
Acked-by: Eelco Chaudron <echaudro@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net resend] net: sched: cbq: create block for q->link.block
2017-11-27 17:37 [patch net resend] net: sched: cbq: create block for q->link.block Jiri Pirko
2017-11-28 9:16 ` Eelco Chaudron
@ 2017-11-28 10:14 ` Ivan Vecera
2017-11-28 21:05 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Ivan Vecera @ 2017-11-28 10:14 UTC (permalink / raw)
To: Jiri Pirko, netdev; +Cc: davem, jhs, xiyou.wangcong, mlxsw, jaster
On 27.11.2017 18:37, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@mellanox.com>
>
> 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>
> ---
> net/sched/sch_cbq.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
> index 6361be7..525eb3a 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)
> 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;
>
Thanks for quick fix.
Reviewed-by: Ivan Vecera <ivecera@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch net resend] net: sched: cbq: create block for q->link.block
2017-11-27 17:37 [patch net resend] net: sched: cbq: create block for q->link.block Jiri Pirko
2017-11-28 9:16 ` Eelco Chaudron
2017-11-28 10:14 ` Ivan Vecera
@ 2017-11-28 21:05 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-11-28 21:05 UTC (permalink / raw)
To: jiri; +Cc: netdev, jhs, xiyou.wangcong, mlxsw, jaster, ivecera
From: Jiri Pirko <jiri@resnulli.us>
Date: Mon, 27 Nov 2017 18:37:21 +0100
> From: Jiri Pirko <jiri@mellanox.com>
>
> 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>
Applied and queued up for -stable, thanks Jiri.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-28 21:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-27 17:37 [patch net resend] net: sched: cbq: create block for q->link.block Jiri Pirko
2017-11-28 9:16 ` Eelco Chaudron
2017-11-28 10:14 ` Ivan Vecera
2017-11-28 21:05 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).