From: Eric Dumazet Date: Sun, 3 May 2020 03:09:25 +0000 (-0700) Subject: net_sched: sch_skbprio: add message validation to skbprio_change() X-Git-Tag: v5.15~3931^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2761121af87de45951989a0adada917837d8fa82;p=platform%2Fkernel%2Flinux-starfive.git net_sched: sch_skbprio: add message validation to skbprio_change() Do not assume the attribute has the right size. Fixes: aea5f654e6b7 ("net/sched: add skbprio scheduler") Signed-off-by: Eric Dumazet Reported-by: syzbot Signed-off-by: David S. Miller --- diff --git a/net/sched/sch_skbprio.c b/net/sched/sch_skbprio.c index 0fb10abf7579..7a5e4c454715 100644 --- a/net/sched/sch_skbprio.c +++ b/net/sched/sch_skbprio.c @@ -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; }