]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
tools/bpftool: Fix attaching flow dissector
authorLorenz Bauer <lmb@cloudflare.com>
Thu, 5 Nov 2020 11:52:30 +0000 (11:52 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:18 +0000 (19:22 +0100)
[ Upstream commit f9b7ff0d7f7a466a920424246e7ddc2b84c87e52 ]

My earlier patch to reject non-zero arguments to flow dissector attach
broke attaching via bpftool. Instead of 0 it uses -1 for target_fd.
Fix this by passing a zero argument when attaching the flow dissector.

Fixes: 1b514239e859 ("bpf: flow_dissector: Check value of unused flags to BPF_PROG_ATTACH")
Reported-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20201105115230.296657-1-lmb@cloudflare.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/prog.c

index d393eb8263a6042c10bac1d60e37a1da6b107495..994506540e564300e8ad76de78ee95acd97a5960 100644 (file)
@@ -741,7 +741,7 @@ static int parse_attach_detach_args(int argc, char **argv, int *progfd,
        }
 
        if (*attach_type == BPF_FLOW_DISSECTOR) {
-               *mapfd = -1;
+               *mapfd = 0;
                return 0;
        }