net_sched: sch_skbprio: add message validation to skbprio_change()
authorEric Dumazet <edumazet@google.com>
Sun, 3 May 2020 03:09:25 +0000 (20:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 3 May 2020 22:52:13 +0000 (15:52 -0700)
Do not assume the attribute has the right size.

Fixes: aea5f654e6b7 ("net/sched: add skbprio scheduler")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_skbprio.c

index 0fb10ab..7a5e4c4 100644 (file)
@@ -169,6 +169,9 @@ static int skbprio_change(struct Qdisc *sch, struct nlattr *opt,
 {
        struct tc_skbprio_qopt *ctl = nla_data(opt);
 
+       if (opt->nla_len != nla_attr_size(sizeof(*ctl)))
+               return -EINVAL;
+
        sch->limit = ctl->limit;
        return 0;
 }