]> git.itanic.dy.fi Git - linux-stable/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 May 2020 05:57:17 +0000 (07:57 +0200)
[ Upstream commit 2761121af87de45951989a0adada917837d8fa82 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/sch_skbprio.c

index 52c0b6d8f1d79666027bc93023d61ac772ae5161..3d9de52849bc5d919a6aca8ae8b54fbf30a28e81 100644 (file)
@@ -173,6 +173,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;
 }