From: Hirofumi Nakagawa Date: Mon, 25 Sep 2017 18:09:53 +0000 (+0900) Subject: ovl: add NULL check in ovl_alloc_inode X-Git-Tag: v4.13.11~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d22011059462aa003e5825a8180f12db9a980e0c;p=thirdparty%2Fkernel%2Fstable.git ovl: add NULL check in ovl_alloc_inode commit b3885bd6edb41b91a0e3976469f72ae31bfb8d95 upstream. This was detected by fault injection test Signed-off-by: Hirofumi Nakagawa Fixes: 13cf199d0088 ("ovl: allocate an ovl_inode struct") Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index a1464905c1eaa..e2192e1eb564c 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;