summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorHirofumi Nakagawa <nklabs@gmail.com>2017-09-26 03:09:53 +0900
committerMiklos Szeredi <mszeredi@redhat.com>2017-10-19 16:19:51 +0200
commitb3885bd6edb41b91a0e3976469f72ae31bfb8d95 (patch)
tree940f4ed3bf9c0bd235caa39178dff14dbdf75dee /fs
parent33d930e59a98fa10a0db9f56c7fa2f21a4aef9b9 (diff)
downloadlinux-b3885bd6edb41b91a0e3976469f72ae31bfb8d95.tar.gz
linux-b3885bd6edb41b91a0e3976469f72ae31bfb8d95.tar.bz2
linux-b3885bd6edb41b91a0e3976469f72ae31bfb8d95.zip
ovl: add NULL check in ovl_alloc_inode
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
Diffstat (limited to 'fs')
-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 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;