oprofilefs: don't oops on allocation failure
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 10 Mar 2018 21:40:33 +0000 (16:40 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 29 Mar 2018 19:07:48 +0000 (15:07 -0400)
... just short-circuit the creation of potential children

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/oprofile/oprofilefs.c

index d77ebbf..4ea0897 100644 (file)
@@ -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) {