From: Alexander Potapenko <glider@google.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Walter Wu <walter-zh.wu@mediatek.com>,
Dmitriy Vyukov <dvyukov@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Kate Stewart <kstewart@linuxfoundation.org>,
Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH] lib/stackdepot: fix global out-of-bounds in stack_slabs
Date: Mon, 3 Feb 2020 12:10:13 +0100 [thread overview]
Message-ID: <CAG_fn=U917uimKOi8fmewvf8JFEHGFHE9R4oA8z1EPz+knFbaw@mail.gmail.com> (raw)
In-Reply-To: <f2adce7f-3f2f-60d4-4dea-3b146b9d35f5@I-love.SAKURA.ne.jp>
> > - stack_slabs[depot_index + 1] = *prealloc;
> > + /* If this is the last depot slab, do not touch the next one. */
> > + if (depot_index + 1 < STACK_ALLOC_MAX_SLABS)
> > + stack_slabs[depot_index + 1] = *prealloc;
>
> What prevents memory leak (caused by "*prealloc = NULL;")
> when we hit depot_index + 1 >= STACK_ALLOC_MAX_SLABS condition?
>
Nice catch!
We must return from this function instead of setting *prealloc to NULL.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
next prev parent reply other threads:[~2020-02-03 11:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-03 10:29 glider
2020-02-03 11:02 ` Tetsuo Handa
2020-02-03 11:10 ` Alexander Potapenko [this message]
2020-02-18 10:29 glider
2020-02-19 21:37 ` Andrew Morton
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='CAG_fn=U917uimKOi8fmewvf8JFEHGFHE9R4oA8z1EPz+knFbaw@mail.gmail.com' \
--to=glider@google.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=jpoimboe@redhat.com \
--cc=kstewart@linuxfoundation.org \
--cc=linux-mm@kvack.org \
--cc=matthias.bgg@gmail.com \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=tglx@linutronix.de \
--cc=walter-zh.wu@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox