]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftests: bpf: Pass program to bpf_prog_detach in flow_dissector
authorLorenz Bauer <lmb@cloudflare.com>
Mon, 29 Jun 2020 09:56:30 +0000 (10:56 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 30 Jun 2020 17:46:39 +0000 (10:46 -0700)
Calling bpf_prog_detach is incorrect, since it takes target_fd as
its argument. The intention here is to pass it as attach_bpf_fd,
so use bpf_prog_detach2 and pass zero for target_fd.

Fixes: 5f8a1d8a527c ("selftests/bpf: Extend test_flow_dissector to cover link creation")
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200629095630.7933-7-lmb@cloudflare.com
tools/testing/selftests/bpf/prog_tests/flow_dissector.c

index ea14e3ece81202ea8e4d922a1e0b041b2f2e2c99..f11f187990e95b87cb81d8457a976d8bb86f9fdd 100644 (file)
@@ -527,8 +527,8 @@ static void test_skb_less_prog_attach(struct bpf_flow *skel, int tap_fd)
 
        run_tests_skb_less(tap_fd, skel->maps.last_dissection);
 
-       err = bpf_prog_detach(prog_fd, BPF_FLOW_DISSECTOR);
-       CHECK(err, "bpf_prog_detach", "err %d errno %d\n", err, errno);
+       err = bpf_prog_detach2(prog_fd, 0, BPF_FLOW_DISSECTOR);
+       CHECK(err, "bpf_prog_detach2", "err %d errno %d\n", err, errno);
 }
 
 static void test_skb_less_link_create(struct bpf_flow *skel, int tap_fd)