netns xfrm: fix "ip xfrm state|policy count" misreport
[safe/jmp/linux-2.6] / net / sched / sch_htb.c
index ec4d463..508cf5f 100644 (file)
@@ -1105,7 +1105,7 @@ htb_dump_class_stats(struct Qdisc *sch, unsigned long arg, struct gnet_dump *d)
        cl->xstats.ctokens = cl->ctokens;
 
        if (gnet_stats_copy_basic(d, &cl->bstats) < 0 ||
-           gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 ||
+           gnet_stats_copy_rate_est(d, NULL, &cl->rate_est) < 0 ||
            gnet_stats_copy_queue(d, &cl->qstats) < 0)
                return -1;
 
@@ -1117,30 +1117,29 @@ static int htb_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new,
 {
        struct htb_class *cl = (struct htb_class *)arg;
 
-       if (cl && !cl->level) {
-               if (new == NULL &&
-                   (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
-                                            &pfifo_qdisc_ops,
-                                            cl->common.classid))
-                   == NULL)
-                       return -ENOBUFS;
-               sch_tree_lock(sch);
-               *old = cl->un.leaf.q;
-               cl->un.leaf.q = new;
-               if (*old != NULL) {
-                       qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
-                       qdisc_reset(*old);
-               }
-               sch_tree_unlock(sch);
-               return 0;
+       if (cl->level)
+               return -EINVAL;
+       if (new == NULL &&
+           (new = qdisc_create_dflt(qdisc_dev(sch), sch->dev_queue,
+                                    &pfifo_qdisc_ops,
+                                    cl->common.classid)) == NULL)
+               return -ENOBUFS;
+
+       sch_tree_lock(sch);
+       *old = cl->un.leaf.q;
+       cl->un.leaf.q = new;
+       if (*old != NULL) {
+               qdisc_tree_decrease_qlen(*old, (*old)->q.qlen);
+               qdisc_reset(*old);
        }
-       return -ENOENT;
+       sch_tree_unlock(sch);
+       return 0;
 }
 
 static struct Qdisc *htb_leaf(struct Qdisc *sch, unsigned long arg)
 {
        struct htb_class *cl = (struct htb_class *)arg;
-       return (cl && !cl->level) ? cl->un.leaf.q : NULL;
+       return !cl->level ? cl->un.leaf.q : NULL;
 }
 
 static void htb_qlen_notify(struct Qdisc *sch, unsigned long arg)
@@ -1345,8 +1344,8 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
                };
 
                /* check for valid classid */
-               if (!classid || TC_H_MAJ(classid ^ sch->handle)
-                   || htb_find(classid, sch))
+               if (!classid || TC_H_MAJ(classid ^ sch->handle) ||
+                   htb_find(classid, sch))
                        goto failure;
 
                /* check maximal depth */