OSDN Git Service

ovl: add NULL check in ovl_alloc_inode
authorHirofumi Nakagawa <nklabs@gmail.com>
Mon, 25 Sep 2017 18:09:53 +0000 (03:09 +0900)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 19 Oct 2017 14:19:51 +0000 (16:19 +0200)
This was detected by fault injection test

Signed-off-by: Hirofumi Nakagawa <nklabs@gmail.com>
Fixes: 13cf199d0088 ("ovl: allocate an ovl_inode struct")
Cc: <stable@vger.kernel.org> # v4.13
fs/overlayfs/super.c

index 092d150..f5738e9 100644 (file)
@@ -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;