Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / net / sched / cls_api.c
index 964f5e4f4b8ac641f3f96b1b5a69d3c64aa70d48..8e118af9097345a500e1006bff6fa5c108435603 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/kmod.h>
-#include <linux/netlink.h>
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <net/net_namespace.h>
@@ -118,7 +117,7 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp)
 
 /* Add/change/delete/get a filter node */
 
-static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
+static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n)
 {
        struct net *net = sock_net(skb->sk);
        struct nlattr *tca[TCA_MAX + 1];
@@ -141,7 +140,12 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
 
        if ((n->nlmsg_type != RTM_GETTFILTER) && !capable(CAP_NET_ADMIN))
                return -EPERM;
+
 replay:
+       err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL);
+       if (err < 0)
+               return err;
+
        t = nlmsg_data(n);
        protocol = TC_H_MIN(t->tcm_info);
        prio = TC_H_MAJ(t->tcm_info);
@@ -164,10 +168,6 @@ replay:
        if (dev == NULL)
                return -ENODEV;
 
-       err = nlmsg_parse(n, sizeof(*t), tca, TCA_MAX, NULL);
-       if (err < 0)
-               return err;
-
        /* Find qdisc */
        if (!parent) {
                q = dev->qdisc;
@@ -427,7 +427,7 @@ static int tc_dump_tfilter(struct sk_buff *skb, struct netlink_callback *cb)
        const struct Qdisc_class_ops *cops;
        struct tcf_dump_args arg;
 
-       if (cb->nlh->nlmsg_len < NLMSG_LENGTH(sizeof(*tcm)))
+       if (nlmsg_len(cb->nlh) < sizeof(*tcm))
                return skb->len;
        dev = __dev_get_by_index(net, tcm->tcm_ifindex);
        if (!dev)