From: Dmitry Vyukov <dvyukov@google.com>
To: Christopher Lameter <cl@linux.com>
Cc: akpm@linuxfoundation.org, Linux-MM <linux-mm@kvack.org>,
stable@kernel.org, David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed
Date: Sun, 6 Jan 2019 16:57:47 +0100 [thread overview]
Message-ID: <CACT4Y+avxq-9MshcDAtKMpGbQPBGvAmK801TuTgiK12onM9H9Q@mail.gmail.com> (raw)
In-Reply-To: <0100016819f5682e-a7e2541c-4390-4e14-ac65-8793243215c6-000000@email.amazonses.com>
On Fri, Jan 4, 2019 at 6:42 PM Christopher Lameter <cl@linux.com> wrote:
>
> From: Christoph Lameter <cl@linux.com>
>
> Callers of __alloc_alien() check for NULL.
> We must do the same check in __alloc_alien() after the allocation of
> the alien cache to avoid potential NULL pointer dereferences
> should the allocation fail.
>
> Fixes: 49dfc304ba241b315068023962004542c5118103 ("slab: use the lock on alien_cache, instead of the lock on array_cache")
> Fixes: c8522a3a5832b843570a3315674f5a3575958a5 ("Slab: introduce alloc_alien")
> Signed-off-by: Christoph Lameter <cl@linux.com>
Please also add the Reported-by tag to commit for tracking purposes:
Reported-by: syzbot+d6ed4ec679652b4fd4e4@syzkaller.appspotmail.com
> Index: linux/mm/slab.c
> ===================================================================
> --- linux.orig/mm/slab.c
> +++ linux/mm/slab.c
> @@ -666,8 +666,10 @@ static struct alien_cache *__alloc_alien
> struct alien_cache *alc = NULL;
>
> alc = kmalloc_node(memsize, gfp, node);
> - init_arraycache(&alc->ac, entries, batch);
> - spin_lock_init(&alc->lock);
> + if (alc) {
> + init_arraycache(&alc->ac, entries, batch);
> + spin_lock_init(&alc->lock);
> + }
> return alc;
> }
>
next prev parent reply other threads:[~2019-01-06 15:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-04 17:42 Christopher Lameter
2019-01-04 17:42 ` Christopher Lameter
2019-01-06 15:57 ` Dmitry Vyukov [this message]
2019-01-06 15:57 ` Dmitry Vyukov
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=CACT4Y+avxq-9MshcDAtKMpGbQPBGvAmK801TuTgiK12onM9H9Q@mail.gmail.com \
--to=dvyukov@google.com \
--cc=akpm@linuxfoundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=stable@kernel.org \
/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