From: Sasha Levin <sashal@kernel•org>
To: linux-kernel@vger•kernel.org, stable@vger•kernel.org
Cc: Alban Crequy <alban@kinvolk•io>,
Quentin Monnet <quentin.monnet@netronome•com>,
Song Liu <songliubraving@fb•com>,
Jakub Kicinski <jakub.kicinski@netronome•com>,
Daniel Borkmann <daniel@iogearbox•net>,
Alexei Starovoitov <ast@kernel•org>,
Sasha Levin <sashal@kernel•org>,
netdev@vger•kernel.org, bpf@vger•kernel.org
Subject: [PATCH AUTOSEL 5.0 22/34] tools: bpftool: fix infinite loop in map create
Date: Thu, 16 May 2019 07:39:19 -0400 [thread overview]
Message-ID: <20190516113932.8348-22-sashal@kernel.org> (raw)
In-Reply-To: <20190516113932.8348-1-sashal@kernel.org>
From: Alban Crequy <alban@kinvolk•io>
[ Upstream commit 8694d8c1f82cccec9380e0d3720b84eee315dfb7 ]
"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: 0b592b5a01be ("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>
Signed-off-by: Sasha Levin <sashal@kernel•org>
---
tools/bpf/bpftool/map.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 1ef1ee2280a28..227766d9f43b1 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -1111,6 +1111,9 @@ static int do_create(int argc, char **argv)
return -1;
}
NEXT_ARG();
+ } else {
+ p_err("unknown arg %s", *argv);
+ return -1;
}
}
--
2.20.1
next prev parent reply other threads:[~2019-05-16 11:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 11:38 [PATCH AUTOSEL 5.0 01/34] xfrm: policy: Fix out-of-bound array accesses in __xfrm_policy_unlink Sasha Levin
2019-05-16 11:38 ` [PATCH AUTOSEL 5.0 02/34] xfrm: Reset secpath in xfrm failure Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 03/34] xfrm6_tunnel: Fix potential panic when unloading xfrm6_tunnel module Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 04/34] vti4: ipip tunnel deregistration fixes Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 05/34] xfrm: clean up xfrm protocol checks Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 06/34] esp4: add length check for UDP encapsulation Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 07/34] xfrm: Honor original L3 slave device in xfrmi policy lookup Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 08/34] xfrm4: Fix uninitialized memory read in _decode_session4 Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 18/34] mac80211: Fix kernel panic due to use of txq after free Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 19/34] net: ieee802154: fix missing checks for regmap_update_bits Sasha Levin
2019-05-16 11:39 ` Sasha Levin [this message]
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 23/34] bpf: Fix preempt_enable_no_resched() abuse Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 24/34] qmi_wwan: new Wistron, ZTE and D-Link devices Sasha Levin
2019-05-16 11:39 ` [PATCH AUTOSEL 5.0 25/34] iwlwifi: mvm: check for length correctness in iwl_mvm_create_skb() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190516113932.8348-22-sashal@kernel.org \
--to=sashal@kernel$(echo .)org \
--cc=alban@kinvolk$(echo .)io \
--cc=ast@kernel$(echo .)org \
--cc=bpf@vger$(echo .)kernel.org \
--cc=daniel@iogearbox$(echo .)net \
--cc=jakub.kicinski@netronome$(echo .)com \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=quentin.monnet@netronome$(echo .)com \
--cc=songliubraving@fb$(echo .)com \
--cc=stable@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox