]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/bpf/inode.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[karo-tx-linux.git] / kernel / bpf / inode.c
index 0b030c9126d3a5f5452461f4df3a5349d80ad4a7..9bbd33497d3d0846de8ebd7b74828e5566045e68 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/parser.h>
 #include <linux/filter.h>
 #include <linux/bpf.h>
+#include <linux/bpf_trace.h>
 
 enum bpf_type {
        BPF_TYPE_UNSPEC = 0,
@@ -281,6 +282,13 @@ int bpf_obj_pin_user(u32 ufd, const char __user *pathname)
        ret = bpf_obj_do_pin(pname, raw, type);
        if (ret != 0)
                bpf_any_put(raw, type);
+       if ((trace_bpf_obj_pin_prog_enabled() ||
+            trace_bpf_obj_pin_map_enabled()) && !ret) {
+               if (type == BPF_TYPE_PROG)
+                       trace_bpf_obj_pin_prog(raw, ufd, pname);
+               if (type == BPF_TYPE_MAP)
+                       trace_bpf_obj_pin_map(raw, ufd, pname);
+       }
 out:
        putname(pname);
        return ret;
@@ -342,8 +350,15 @@ int bpf_obj_get_user(const char __user *pathname)
        else
                goto out;
 
-       if (ret < 0)
+       if (ret < 0) {
                bpf_any_put(raw, type);
+       } else if (trace_bpf_obj_get_prog_enabled() ||
+                  trace_bpf_obj_get_map_enabled()) {
+               if (type == BPF_TYPE_PROG)
+                       trace_bpf_obj_get_prog(raw, ret, pname);
+               if (type == BPF_TYPE_MAP)
+                       trace_bpf_obj_get_map(raw, ret, pname);
+       }
 out:
        putname(pname);
        return ret;
@@ -414,7 +429,7 @@ static int bpf_parse_options(char *data, struct bpf_mount_opts *opts)
 
 static int bpf_fill_super(struct super_block *sb, void *data, int silent)
 {
-       static struct tree_descr bpf_rfiles[] = { { "" } };
+       static const struct tree_descr bpf_rfiles[] = { { "" } };
        struct bpf_mount_opts opts;
        struct inode *inode;
        int ret;