diff options
author | John Fastabend <john.fastabend@gmail.com> | 2017-08-28 17:11:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-28 21:13:22 +0300 |
commit | 81374aaa2693f8d3cd6cf3656a02ac8cf5c7ebea (patch) | |
tree | 24e0a68c98a92ade186346a193fa6900f8ddd562 /tools/testing/selftests/bpf/sockmap_verdict_prog.c | |
parent | ed85054d34e2dfb5e9fac95980cf038ecf19225c (diff) | |
download | linux-81374aaa2693f8d3cd6cf3656a02ac8cf5c7ebea.tar.xz |
bpf: harden sockmap program attach to ensure correct map type
When attaching a program to sockmap we need to check map type
is correct.
Fixes: 174a79ff9515 ("bpf: sockmap with sk redirect support")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/bpf/sockmap_verdict_prog.c')
-rw-r--r-- | tools/testing/selftests/bpf/sockmap_verdict_prog.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/sockmap_verdict_prog.c index dada2072dec5..9b99bd10807d 100644 --- a/tools/testing/selftests/bpf/sockmap_verdict_prog.c +++ b/tools/testing/selftests/bpf/sockmap_verdict_prog.c @@ -26,6 +26,13 @@ struct bpf_map_def SEC("maps") sock_map_tx = { .max_entries = 20, }; +struct bpf_map_def SEC("maps") sock_map_break = { + .type = BPF_MAP_TYPE_ARRAY, + .key_size = sizeof(int), + .value_size = sizeof(int), + .max_entries = 20, +}; + SEC("sk_skb2") int bpf_prog2(struct __sk_buff *skb) { |