All of lore.kernel.org
 help / color / mirror / Atom feed
From: sdf@google.com
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	syzbot <syzbot+5d1da78b375c3b5e6c2b@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, bpf@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] bpf: add missing percpu_counter_destroy() in htab_map_alloc()
Date: Sat, 10 Sep 2022 13:16:56 -0700	[thread overview]
Message-ID: <YxzwuDgGF6qBhWct@google.com> (raw)
In-Reply-To: <e2e4cc0e-9d36-4ca1-9bfa-ce23e6f8310b@I-love.SAKURA.ne.jp>

On 09/11, Tetsuo Handa wrote:
> syzbot is reporting ODEBUG bug in htab_map_alloc() [1], for
> commit 86fe28f7692d96d2 ("bpf: Optimize element count in non-preallocated
> hash map.") added percpu_counter_init() to htab_map_alloc() but forgot to
> add percpu_counter_destroy() to the error path.

> Link: https://syzkaller.appspot.com/bug?extid=5d1da78b375c3b5e6c2b [1]
> Reported-by: syzbot  
> <syzbot+5d1da78b375c3b5e6c2b@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Thanks!

Reviewed-by: Stanislav Fomichev <sdf@google.com>

> Fixes: 86fe28f7692d96d2 ("bpf: Optimize element count in non-preallocated  
> hash map.")
> ---
>   kernel/bpf/hashtab.c | 2 ++
>   1 file changed, 2 insertions(+)

> diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> index 0fe3f136cbbe..86aec20c22d0 100644
> --- a/kernel/bpf/hashtab.c
> +++ b/kernel/bpf/hashtab.c
> @@ -622,6 +622,8 @@ static struct bpf_map *htab_map_alloc(union bpf_attr  
> *attr)
>   free_prealloc:
>   	prealloc_destroy(htab);
>   free_map_locked:
> +	if (htab->use_percpu_counter)
> +		percpu_counter_destroy(&htab->pcount);
>   	for (i = 0; i < HASHTAB_MAP_LOCK_COUNT; i++)
>   		free_percpu(htab->map_locked[i]);
>   	bpf_map_area_free(htab->buckets);
> --
> 2.18.4


  reply	other threads:[~2022-09-10 20:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 22:48 [syzbot] WARNING: ODEBUG bug in htab_map_alloc syzbot
2022-09-10 15:07 ` [PATCH] bpf: add missing percpu_counter_destroy() in htab_map_alloc() Tetsuo Handa
2022-09-10 20:16   ` sdf [this message]
2022-09-10 23:11   ` Alexei Starovoitov
2022-09-10 23:20   ` patchwork-bot+netdevbpf
     [not found] ` <20220910020633.2620505-1-eadavis@sina.com>
2022-09-10 20:29   ` [PATCH] kernel/bpf: htab_map_alloc() exit by free_map_locked logic issue Stanislav Fomichev

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=YxzwuDgGF6qBhWct@google.com \
    --to=sdf@google.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=syzbot+5d1da78b375c3b5e6c2b@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.