]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - samples/bpf/bpf_load.c
samples/bpf: fix bpf loader
[mirror_ubuntu-zesty-kernel.git] / samples / bpf / bpf_load.c
index 97913e109b144f9f02491c1557ff179171d05318..62f54d6eb8bf5c3381662ac76891c2aba3c64e83 100644 (file)
@@ -317,6 +317,10 @@ int load_bpf_file(char *path)
                                    &shdr_prog, &data_prog))
                                continue;
 
+                       if (shdr_prog.sh_type != SHT_PROGBITS ||
+                           !(shdr_prog.sh_flags & SHF_EXECINSTR))
+                               continue;
+
                        insns = (struct bpf_insn *) data_prog->d_buf;
 
                        processed_sec[shdr.sh_info] = true;