From: Al Viro Date: Sat, 10 Mar 2018 21:40:33 +0000 (-0500) Subject: oprofilefs: don't oops on allocation failure X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a7498968338da9b928f5d8054acc8be6ed2bc14c;p=linux.git oprofilefs: don't oops on allocation failure ... just short-circuit the creation of potential children Signed-off-by: Al Viro --- diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c index d77ebbfc67c98..4ea08979312ca 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) {