From: Al Viro Date: Sat, 10 Mar 2018 21:40:33 +0000 (-0500) Subject: oprofilefs: don't oops on allocation failure X-Git-Tag: v5.15~9066^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a7498968338da9b928f5d8054acc8be6ed2bc14c;p=platform%2Fkernel%2Flinux-starfive.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 d77ebbf..4ea0897 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) {