From 3c767ca6a46fcdef80c989cfea5e2bc36e2e2844 Mon Sep 17 00:00:00 2001 From: Shakeel Butt Date: Thu, 24 Oct 2019 18:01:42 +0800 Subject: [PATCH] slub: don't panic for memcg kmem cache creation failure mainline inclusion from mainline-v5.3-rc1 commit cb097cd48313575b03a5de092a04f6af8aa0739e category: bugfix bugzilla: 18470 CVE: NA ------------------------------------------------- Currently for CONFIG_SLUB, if a memcg kmem cache creation is failed and the corresponding root kmem cache has SLAB_PANIC flag, the kernel will be crashed. This is unnecessary as the kernel can handle the creation failures of memcg kmem caches. Additionally CONFIG_SLAB does not implement this behavior. So, to keep the behavior consistent between SLAB and SLUB, removing the panic for memcg kmem cache creation failures. The root kmem cache creation failure for SLAB_PANIC correctly panics for both SLAB and SLUB. Link: http://lkml.kernel.org/r/20190619232514.58994-1-shakeelb@google.com Reported-by: Dave Hansen Signed-off-by: Shakeel Butt Acked-by: David Rientjes Acked-by: Michal Hocko Cc: Alexey Dobriyan Cc: Johannes Weiner Cc: Christoph Lameter Cc: Roman Gushchin Cc: Pekka Enberg Cc: Joonsoo Kim Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: tongtiangen Reviewed-by: Kefeng Wang Signed-off-by: Yang Yingliang --- mm/slub.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 42940fa6d55c..288d547b301c 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3610,10 +3610,6 @@ static int kmem_cache_open(struct kmem_cache *s, slab_flags_t flags) free_kmem_cache_nodes(s); error: - if (flags & SLAB_PANIC) - panic("Cannot create slab %s size=%u realsize=%u order=%u offset=%u flags=%lx\n", - s->name, s->size, s->size, - oo_order(s->oo), s->offset, (unsigned long)flags); return -EINVAL; } -- GitLab