mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
tools: bpftool: return from do_event_pipe() on bad arguments
[ Upstream commit785e76d7a2] When command line parsing fails in the while loop in do_event_pipe() because the number of arguments is incorrect or because the keyword is unknown, an error message is displayed, but bpftool remains stuck in the loop. Make sure we exit the loop upon failure. Fixes:f412eed9df("tools: bpftool: add simple perf event output reader") Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1dec7a1e6a
commit
939817cd00
@@ -194,8 +194,10 @@ int do_event_pipe(int argc, char **argv)
|
||||
}
|
||||
|
||||
while (argc) {
|
||||
if (argc < 2)
|
||||
if (argc < 2) {
|
||||
BAD_ARG();
|
||||
goto err_close_map;
|
||||
}
|
||||
|
||||
if (is_prefix(*argv, "cpu")) {
|
||||
char *endptr;
|
||||
@@ -221,6 +223,7 @@ int do_event_pipe(int argc, char **argv)
|
||||
NEXT_ARG();
|
||||
} else {
|
||||
BAD_ARG();
|
||||
goto err_close_map;
|
||||
}
|
||||
|
||||
do_all = false;
|
||||
|
||||
Reference in New Issue
Block a user