]> git.baikalelectronics.ru Git - kernel.git/commit
tools: bpftool: fix infinite loop in map create
authorAlban Crequy <alban@kinvolk.io>
Fri, 12 Apr 2019 12:40:50 +0000 (14:40 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Apr 2019 00:20:06 +0000 (17:20 -0700)
commitdae16c7185f5eee12948c9d8ea5a882e1db7c553
treed348d15c82218e9388a6b537dafb83cb4677a846
parentf52276c9872b5424f371a5682f824e5e50aaf402
tools: bpftool: fix infinite loop in map create

"bpftool map create" has an infinite loop on "while (argc)". The error
case is missing.

Symptoms: when forgetting to type the keyword 'type' in front of 'hash':
$ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
(infinite loop, taking all the CPU)
^C

After the patch:
$ sudo bpftool map create /sys/fs/bpf/dir/foobar hash key 8 value 8 entries 128
Error: unknown arg hash

Fixes: afbf4682a873 ("tools: bpftool: add map create command")
Signed-off-by: Alban Crequy <alban@kinvolk.io>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/bpf/bpftool/map.c