vserver 1.9.3
[linux-2.6.git] / net / sched / cls_api.c
index e769513..71c85ad 100644 (file)
@@ -139,7 +139,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
        struct tcf_proto_ops *tp_ops;
        struct Qdisc_class_ops *cops;
        unsigned long cl = 0;
-       unsigned long fh, fh_s;
+       unsigned long fh;
        int err;
 
        if (prio == 0) {
@@ -231,8 +231,12 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
                tp->classify = tp_ops->classify;
                tp->classid = parent;
                err = -EBUSY;
-               if (!try_module_get(tp_ops->owner) ||
-                   (err = tp_ops->init(tp)) != 0) {
+               if (!try_module_get(tp_ops->owner)) {
+                       kfree(tp);
+                       goto errout;
+               }
+               if ((err = tp_ops->init(tp)) != 0) {
+                       module_put(tp_ops->owner);
                        kfree(tp);
                        goto errout;
                }
@@ -245,7 +249,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
        } else if (tca[TCA_KIND-1] && rtattr_strcmp(tca[TCA_KIND-1], tp->ops->kind))
                goto errout;
 
-       fh_s = fh = tp->ops->get(tp, t->tcm_handle);
+       fh = tp->ops->get(tp, t->tcm_handle);
 
        if (fh == 0) {
                if (n->nlmsg_type == RTM_DELTFILTER && t->tcm_handle == 0) {
@@ -253,7 +257,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
                        *back = tp->next;
                        qdisc_unlock_tree(dev);
 
-                       tfilter_notify(skb, n, tp, fh_s, RTM_DELTFILTER);
+                       tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
                        tcf_destroy(tp);
                        err = 0;
                        goto errout;
@@ -272,7 +276,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
                case RTM_DELTFILTER:
                        err = tp->ops->delete(tp, fh);
                        if (err == 0)
-                               tfilter_notify(skb, n, tp, fh_s, RTM_DELTFILTER);
+                               tfilter_notify(skb, n, tp, fh, RTM_DELTFILTER);
                        goto errout;
                case RTM_GETTFILTER:
                        err = tfilter_notify(skb, n, tp, fh, RTM_NEWTFILTER);