All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: sched: gred: pass the right attribute to gred_change_table_def()
@ 2018-10-26 22:51 Jakub Kicinski
  2018-10-29  2:24 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2018-10-26 22:51 UTC (permalink / raw)
  To: davem; +Cc: tgraf, jhs, xiyou.wangcong, netdev, oss-drivers, Jakub Kicinski

gred_change_table_def() takes a pointer to TCA_GRED_DPS attribute,
and expects it will be able to interpret its contents as
struct tc_gred_sopt.  Pass the correct gred attribute, instead of
TCA_OPTIONS.

This bug meant the table definition could never be changed after
Qdisc was initialized (unless whatever TCA_OPTIONS contained both
passed netlink validation and was a valid struct tc_gred_sopt...).

Old behaviour:
$ ip link add type dummy
$ tc qdisc replace dev dummy0 parent root handle 7: \
     gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
     gred setup vqs 4 default 0
RTNETLINK answers: Invalid argument

Now:
$ ip link add type dummy
$ tc qdisc replace dev dummy0 parent root handle 7: \
     gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
     gred setup vqs 4 default 0
$ tc qdisc replace dev dummy0 parent root handle 7: \
     gred setup vqs 4 default 0

Fixes: f62d6b936df5 ("[PKT_SCHED]: GRED: Use central VQ change procedure")
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 net/sched/sch_gred.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index cbe4831f46f4..4a042abf844c 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -413,7 +413,7 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt,
 	if (tb[TCA_GRED_PARMS] == NULL && tb[TCA_GRED_STAB] == NULL) {
 		if (tb[TCA_GRED_LIMIT] != NULL)
 			sch->limit = nla_get_u32(tb[TCA_GRED_LIMIT]);
-		return gred_change_table_def(sch, opt);
+		return gred_change_table_def(sch, tb[TCA_GRED_DPS]);
 	}
 
 	if (tb[TCA_GRED_PARMS] == NULL ||
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net: sched: gred: pass the right attribute to gred_change_table_def()
  2018-10-26 22:51 [PATCH net] net: sched: gred: pass the right attribute to gred_change_table_def() Jakub Kicinski
@ 2018-10-29  2:24 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-29  2:24 UTC (permalink / raw)
  To: jakub.kicinski; +Cc: tgraf, jhs, xiyou.wangcong, netdev, oss-drivers

From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri, 26 Oct 2018 15:51:06 -0700

> gred_change_table_def() takes a pointer to TCA_GRED_DPS attribute,
> and expects it will be able to interpret its contents as
> struct tc_gred_sopt.  Pass the correct gred attribute, instead of
> TCA_OPTIONS.
> 
> This bug meant the table definition could never be changed after
> Qdisc was initialized (unless whatever TCA_OPTIONS contained both
> passed netlink validation and was a valid struct tc_gred_sopt...).
 ...
> Fixes: f62d6b936df5 ("[PKT_SCHED]: GRED: Use central VQ change procedure")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Quite an ancient bug :-)

Applied and queued up for -stable, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-29 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 22:51 [PATCH net] net: sched: gred: pass the right attribute to gred_change_table_def() Jakub Kicinski
2018-10-29  2:24 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.