selftests: bpf: Fix detach from sockmap tests
authorLorenz Bauer <lmb@cloudflare.com>
Thu, 9 Jul 2020 11:51:51 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Jul 2020 06:13:24 +0000 (08:13 +0200)
commit0f488ed82212934bf3eac7d910c99a17d3779c13
treec8fb75285c69171b47e38f8b4bf810ccd039b9d5
parent3c150de3bc7c1a605819b08475a96905239d1081
selftests: bpf: Fix detach from sockmap tests

[ Upstream commit f43cb0d672aa8eb09bfdb779de5900c040487d1d ]

Fix sockmap tests which rely on old bpf_prog_dispatch behaviour.
In the first case, the tests check that detaching without giving
a program succeeds. Since these are not the desired semantics,
invert the condition. In the second case, the clean up code doesn't
supply the necessary program fds.

Fixes: bb0de3131f4c ("bpf: sockmap: Require attach_bpf_fd when detaching a program")
Reported-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20200709115151.75829-1-lmb@cloudflare.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/bpf/test_maps.c