From: Eric Biggers Date: Sat, 3 Dec 2016 20:28:53 +0000 (-0500) Subject: mbcache: don't BUG() if entry cache cannot be allocated X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=21d0f4fa8e7b026cdae988f99f4c3aab154d5b7c;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git mbcache: don't BUG() if entry cache cannot be allocated mbcache can be a module that is loaded long after startup, when someone asks to mount an ext2 or ext4 filesystem. Therefore it should not BUG() if kmem_cache_create() fails, but rather just fail the module load. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o Reviewed-by: Jan Kara --- diff --git a/fs/mbcache.c b/fs/mbcache.c index 31e54c25d16f..c56ab2164d6b 100644 --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -420,7 +420,8 @@ static int __init mbcache_init(void) mb_entry_cache = kmem_cache_create("mbcache", sizeof(struct mb_cache_entry), 0, SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL); - BUG_ON(!mb_entry_cache); + if (!mb_entry_cache) + return -ENOMEM; return 0; }