Skip to contentSkip to conversation

ovl: add NULL check in ovl_alloc_inode

PATCH In review Hirofumi Nakagawa 2 participants 2 messages Sep 25, 2017 – Sep 26, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ovl: add NULL check in ovl_alloc_inode

This was detected by fault injection test

---
 fs/overlayfs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/overlayfs/super.c +3 -0
index fd5ea4facc62..701aa2f3536d 100644
@@ -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;
Signature · 1 line
2.14.1
maintainer
#1 lore raw
Quoted 3 lines · Hirofumi Nakagawa

This was detected by fault injection test

Fixes 13cf199d0088 ("ovl: allocate an ovl_inode struct")
Cc <[email protected]> # v4.13
Quoted 25 lines
---
 fs/overlayfs/super.c | 3 +++
 1 file changed, 3 insertions(+)
fs/overlayfs/super.c +3 -1
index fd5ea4facc62..701aa2f3536d 100644
@@ -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;
--

2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html