Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:27 +0100
committerJiri Slaby <jslaby@suse.cz>2019-01-18 07:53:36 +0100
commit74e259922b5ca9dde72b7a56dddcdb13b17d4f8e (patch)
tree31297a8bc64ea23696789d96e1b803145f68ed89
parentd0aa720babe3ec4151382ec4b7357677f0699f04 (diff)
slab: alien caches must not be initialized if the allocation
of the alien cache failed (bnc#1012628).
-rw-r--r--patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch52
-rw-r--r--series.conf1
2 files changed, 53 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch b/patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch
new file mode 100644
index 0000000000..0d8014bf1d
--- /dev/null
+++ b/patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch
@@ -0,0 +1,52 @@
+From: Christoph Lameter <cl@linux.com>
+Date: Tue, 8 Jan 2019 15:23:00 -0800
+Subject: [PATCH] slab: alien caches must not be initialized if the allocation
+ of the alien cache failed
+References: bnc#1012628
+Patch-mainline: 4.20.3
+Git-commit: 09c2e76ed734a1d36470d257a778aaba28e86531
+
+commit 09c2e76ed734a1d36470d257a778aaba28e86531 upstream.
+
+Callers of __alloc_alien() check for NULL. We must do the same check in
+__alloc_alien_cache to avoid NULL pointer dereferences on allocation
+failures.
+
+Link: http://lkml.kernel.org/r/010001680f42f192-82b4e12e-1565-4ee0-ae1f-1e98974906aa-000000@email.amazonses.com
+Fixes: 49dfc304ba241 ("slab: use the lock on alien_cache, instead of the lock on array_cache")
+Fixes: c8522a3a5832b ("Slab: introduce alloc_alien")
+Signed-off-by: Christoph Lameter <cl@linux.com>
+Reported-by: syzbot+d6ed4ec679652b4fd4e4@syzkaller.appspotmail.com
+Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
+Cc: Pekka Enberg <penberg@kernel.org>
+Cc: David Rientjes <rientjes@google.com>
+Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ mm/slab.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/mm/slab.c b/mm/slab.c
+index 2a5654bb3b3f..9d5de959d9d9 100644
+--- a/mm/slab.c
++++ b/mm/slab.c
+@@ -679,8 +679,10 @@ static struct alien_cache *__alloc_alien_cache(int node, int entries,
+ 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;
+ }
+
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 3d1356a60c..4e54b8e4e9 100644
--- a/series.conf
+++ b/series.conf
@@ -265,6 +265,7 @@
patches.kernel.org/4.20.3-025-USB-storage-add-quirk-for-SMI-SM3350.patch
patches.kernel.org/4.20.3-026-USB-Add-USB_QUIRK_DELAY_CTRL_MSG-quirk-for-Cor.patch
patches.kernel.org/4.20.3-027-fork-memcg-fix-cached_stacks-case.patch
+ patches.kernel.org/4.20.3-028-slab-alien-caches-must-not-be-initialized-if-t.patch
########################################################
# Build fixes that apply to the vanilla kernel too.