samples/bpf: Ignore already processed ELF sections
authorMickaël Salaün <mic@digikod.net>
Wed, 8 Feb 2017 20:27:42 +0000 (21:27 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Feb 2017 20:22:47 +0000 (17:22 -0300)
Add a missing check for the map fixup loop.

Signed-off-by: Mickaël Salaün <mic@digikod.net>
Acked-by: Joe Stringer <joe@ovn.org>
Acked-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20170208202744.16274-2-mic@digikod.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
samples/bpf/bpf_load.c

index 396e204..e04fe09 100644 (file)
@@ -328,6 +328,8 @@ int load_bpf_file(char *path)
 
        /* load programs that need map fixup (relocations) */
        for (i = 1; i < ehdr.e_shnum; i++) {
+               if (processed_sec[i])
+                       continue;
 
                if (get_sec(elf, i, &ehdr, &shname, &shdr, &data))
                        continue;