* [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed
@ 2019-01-04 17:42 Christopher Lameter
2019-01-04 17:42 ` Christopher Lameter
2019-01-06 15:57 ` Dmitry Vyukov
0 siblings, 2 replies; 4+ messages in thread
From: Christopher Lameter @ 2019-01-04 17:42 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Dmitry Vyukov, stable, David Rientjes, Joonsoo Kim
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>
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;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed
2019-01-04 17:42 [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed Christopher Lameter
@ 2019-01-04 17:42 ` Christopher Lameter
2019-01-06 15:57 ` Dmitry Vyukov
1 sibling, 0 replies; 4+ messages in thread
From: Christopher Lameter @ 2019-01-04 17:42 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Dmitry Vyukov, stable, David Rientjes, Joonsoo Kim
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>
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;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed
2019-01-04 17:42 [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed Christopher Lameter
2019-01-04 17:42 ` Christopher Lameter
@ 2019-01-06 15:57 ` Dmitry Vyukov
2019-01-06 15:57 ` Dmitry Vyukov
1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Vyukov @ 2019-01-06 15:57 UTC (permalink / raw)
To: Christopher Lameter; +Cc: akpm, Linux-MM, stable, David Rientjes, Joonsoo Kim
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;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed
2019-01-06 15:57 ` Dmitry Vyukov
@ 2019-01-06 15:57 ` Dmitry Vyukov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Vyukov @ 2019-01-06 15:57 UTC (permalink / raw)
To: Christopher Lameter; +Cc: akpm, Linux-MM, stable, David Rientjes, Joonsoo Kim
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;
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-01-06 15:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-04 17:42 [FIX] slab: Alien caches must not be initialized if the allocation of the alien cache failed Christopher Lameter
2019-01-04 17:42 ` Christopher Lameter
2019-01-06 15:57 ` Dmitry Vyukov
2019-01-06 15:57 ` Dmitry Vyukov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).