mqprio: Avoid panic if no options are provided
authorThomas Graf <tgraf@redhat.com>
Thu, 22 Dec 2011 02:05:07 +0000 (02:05 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Dec 2011 03:34:56 +0000 (22:34 -0500)
Userspace may not provide TCA_OPTIONS, in fact tc currently does
so not do so if no arguments are specified on the command line.
Return EINVAL instead of panicing.

Signed-off-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_mqprio.c

index f88256c..28de430 100644 (file)
@@ -107,7 +107,7 @@ static int mqprio_init(struct Qdisc *sch, struct nlattr *opt)
        if (!netif_is_multiqueue(dev))
                return -EOPNOTSUPP;
 
-       if (nla_len(opt) < sizeof(*qopt))
+       if (!opt || nla_len(opt) < sizeof(*qopt))
                return -EINVAL;
 
        qopt = nla_data(opt);