]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/sched/sch_netem.c
dsa: fix compile bug on s390
[linux-2.6-omap-h63xx.git] / net / sched / sch_netem.c
index fb0294d0b55e6e71ed87c9b7e1206e755ad5561b..a11959908d9a68c405114d56c5073c0d77647402 100644 (file)
@@ -341,7 +341,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
        for (i = 0; i < n; i++)
                d->table[i] = data[i];
 
-       root_lock = qdisc_root_lock(sch);
+       root_lock = qdisc_root_sleeping_lock(sch);
 
        spin_lock_bh(root_lock);
        d = xchg(&q->delay_dist, d);
@@ -388,6 +388,20 @@ static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = {
        [TCA_NETEM_CORRUPT]     = { .len = sizeof(struct tc_netem_corrupt) },
 };
 
+static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,
+                     const struct nla_policy *policy, int len)
+{
+       int nested_len = nla_len(nla) - NLA_ALIGN(len);
+
+       if (nested_len < 0)
+               return -EINVAL;
+       if (nested_len >= nla_attr_size(0))
+               return nla_parse(tb, maxtype, nla_data(nla) + NLA_ALIGN(len),
+                                nested_len, policy);
+       memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
+       return 0;
+}
+
 /* Parse netlink message to set options */
 static int netem_change(struct Qdisc *sch, struct nlattr *opt)
 {
@@ -399,8 +413,8 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt)
        if (opt == NULL)
                return -EINVAL;
 
-       ret = nla_parse_nested_compat(tb, TCA_NETEM_MAX, opt, netem_policy,
-                                     qopt, sizeof(*qopt));
+       qopt = nla_data(opt);
+       ret = parse_attr(tb, TCA_NETEM_MAX, opt, netem_policy, sizeof(*qopt));
        if (ret < 0)
                return ret;