From a7498968338da9b928f5d8054acc8be6ed2bc14c Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Sat, 10 Mar 2018 16:40:33 -0500
Subject: oprofilefs: don't oops on allocation failure

... just short-circuit the creation of potential children

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 drivers/oprofile/oprofilefs.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'drivers/oprofile/oprofilefs.c')

diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index d77ebbfc67c9..4ea08979312c 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -138,6 +138,9 @@ static int __oprofilefs_create_file(struct dentry *root, char const *name,
 	struct dentry *dentry;
 	struct inode *inode;
 
+	if (!root)
+		return -ENOMEM;
+
 	inode_lock(d_inode(root));
 	dentry = d_alloc_name(root, name);
 	if (!dentry) {
-- 
cgit v1.2.3