From: Hirofumi Nakagawa Date: Mon, 25 Sep 2017 18:09:53 +0000 (+0900) Subject: ovl: add NULL check in ovl_alloc_inode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b3885bd6edb41b91a0e3976469f72ae31bfb8d95;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git ovl: add NULL check in ovl_alloc_inode This was detected by fault injection test Signed-off-by: Hirofumi Nakagawa Fixes: 13cf199d0088 ("ovl: allocate an ovl_inode struct") Cc: # v4.13 --- diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 092d150643c1..f5738e96a052 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c @@ -174,6 +174,9 @@ static struct inode *ovl_alloc_inode(struct super_block *sb) { struct ovl_inode *oi = kmem_cache_alloc(ovl_inode_cachep, GFP_KERNEL); + if (!oi) + return NULL; + oi->cache = NULL; oi->redirect = NULL; oi->version = 0;