bpf: harden sockmap program attach to ensure correct map type
authorJohn Fastabend <john.fastabend@gmail.com>
Mon, 28 Aug 2017 14:11:43 +0000 (07:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Aug 2017 18:13:22 +0000 (11:13 -0700)
commit81374aaa2693f8d3cd6cf3656a02ac8cf5c7ebea
tree24e0a68c98a92ade186346a193fa6900f8ddd562
parented85054d34e2dfb5e9fac95980cf038ecf19225c
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>
kernel/bpf/sockmap.c
tools/testing/selftests/bpf/sockmap_verdict_prog.c
tools/testing/selftests/bpf/test_maps.c