Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHirofumi Nakagawa <nklabs@gmail.com>2017-09-26 03:09:53 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-02 09:54:46 +0100
commitd22011059462aa003e5825a8180f12db9a980e0c (patch)
treec7c691637eeafe45e57849a093938a74f5bf9c87
parent176fab4e08a7a578ff6967a8658fd7429faed58f (diff)
ovl: add NULL check in ovl_alloc_inode
commit b3885bd6edb41b91a0e3976469f72ae31bfb8d95 upstream. This was detected by fault injection test Signed-off-by: Hirofumi Nakagawa <nklabs@gmail.com> Fixes: 13cf199d0088 ("ovl: allocate an ovl_inode struct") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/overlayfs/super.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index a1464905c1ea..e2192e1eb564 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;