Commit 0d393f23 authored by Quentin Monnet's avatar Quentin Monnet Committed by Greg Kroah-Hartman

tools: bpftool: close prog FD before exit on showing a single program

[ Upstream commit d34b0440 ]

When showing metadata about a single program by invoking
"bpftool prog show PROG", the file descriptor referring to the program
is not closed before returning from the function. Let's close it.

Fixes: 71bb428f ("tools: bpf: add bpftool")
Signed-off-by: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: default avatarAndrii Nakryiko <andriin@fb.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c5bb0335
......@@ -381,7 +381,9 @@ static int do_show(int argc, char **argv)
if (fd < 0)
return -1;
return show_prog(fd);
err = show_prog(fd);
close(fd);
return err;
}
if (argc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment