[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW4KENxuuafRFx9ak5rS4mf_i9yO2tN9WqGcB0nM01KiuA@mail.gmail.com>
Date: Fri, 12 Apr 2019 11:07:34 -0700
From: Song Liu <liu.song.a23@...il.com>
To: Quentin Monnet <quentin.monnet@...ronome.com>
Cc: Alban Crequy <alban.crequy@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>, alban@...volk.io,
iago@...volk.io
Subject: Re: [PATCH bpf v2] tools: bpftool: fix infinite loop in map create
On Fri, Apr 12, 2019 at 6:21 AM Quentin Monnet
<quentin.monnet@...ronome.com> wrote:
>
> 2019-04-12 14:40 UTC+0200 ~ Alban Crequy <alban.crequy@...il.com>
> > From: Alban Crequy <alban@...volk.io>
> >
> > "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@...volk.io>
Acked-by: Song Liu <songliubraving@...com>
Thanks for the fix!
> >
> > ---
> >
> > Changes in v2:
> > - Explain the cause of the bug in commitmsg
> > - Add the "fixes" line in the commitmsg (Jakub's review)
> > - Rebase on the bpf tree
> >
> > v1 was initially based on bpf-next and submitted on
> > https://marc.info/?l=linux-kernel&m=155310327709613&w=2
> > ---
> > 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 05b029b934a6..1ccc38718458 100644
> > --- a/tools/bpf/bpftool/map.c
> > +++ b/tools/bpf/bpftool/map.c
> > @@ -1151,6 +1151,9 @@ static int do_create(int argc, char **argv)
> > return -1;
> > }
> > NEXT_ARG();
> > + } else {
> > + p_err("unknown arg %s", *argv);
> > + return -1;
> > }
> > }
> >
> >
>
> Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>
>
> Thanks Alban!
Powered by blists - more mailing lists