Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[sfrench/cifs-2.6.git] / net / sched / cls_bpf.c
index bb1d5a487081f21f80a3042cd424cf7caedf6b37..c37aa8b77fb5d480dfa7a778f9400fe6bca1fd3d 100644 (file)
@@ -45,10 +45,7 @@ struct cls_bpf_prog {
        u32 gen_flags;
        struct tcf_exts exts;
        u32 handle;
-       union {
-               u32 bpf_fd;
-               u16 bpf_num_ops;
-       };
+       u16 bpf_num_ops;
        struct sock_filter *bpf_ops;
        const char *bpf_name;
        struct tcf_proto *tp;
@@ -292,7 +289,6 @@ static bool cls_bpf_destroy(struct tcf_proto *tp, bool force)
                call_rcu(&prog->rcu, __cls_bpf_delete_prog);
        }
 
-       RCU_INIT_POINTER(tp->root, NULL);
        kfree_rcu(head, rcu);
        return true;
 }
@@ -303,9 +299,6 @@ static unsigned long cls_bpf_get(struct tcf_proto *tp, u32 handle)
        struct cls_bpf_prog *prog;
        unsigned long ret = 0UL;
 
-       if (head == NULL)
-               return 0UL;
-
        list_for_each_entry(prog, &head->plist, link) {
                if (prog->handle == handle) {
                        ret = (unsigned long) prog;
@@ -369,9 +362,7 @@ static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog,
                return PTR_ERR(fp);
 
        if (tb[TCA_BPF_NAME]) {
-               name = kmemdup(nla_data(tb[TCA_BPF_NAME]),
-                              nla_len(tb[TCA_BPF_NAME]),
-                              GFP_KERNEL);
+               name = nla_memdup(tb[TCA_BPF_NAME], GFP_KERNEL);
                if (!name) {
                        bpf_prog_put(fp);
                        return -ENOMEM;
@@ -379,7 +370,6 @@ static int cls_bpf_prog_from_efd(struct nlattr **tb, struct cls_bpf_prog *prog,
        }
 
        prog->bpf_ops = NULL;
-       prog->bpf_fd = bpf_fd;
        prog->bpf_name = name;
        prog->filter = fp;
 
@@ -563,9 +553,6 @@ static int cls_bpf_dump_bpf_info(const struct cls_bpf_prog *prog,
 static int cls_bpf_dump_ebpf_info(const struct cls_bpf_prog *prog,
                                  struct sk_buff *skb)
 {
-       if (nla_put_u32(skb, TCA_BPF_FD, prog->bpf_fd))
-               return -EMSGSIZE;
-
        if (prog->bpf_name &&
            nla_put_string(skb, TCA_BPF_NAME, prog->bpf_name))
                return -EMSGSIZE;