summaryrefslogtreecommitdiffstats
path: root/fs/configfs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-03-17 21:49:20 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2012-03-21 02:29:47 +0100
commit0dd6c08a0042ed83037cf5c772d9066e33046427 (patch)
tree9f29ab8ce7c2a5e44b5c1b706ff8fc3ff2dfd6c6 /fs/configfs
parentconfigfs: sanitize configfs_create() (diff)
downloadlinux-0dd6c08a0042ed83037cf5c772d9066e33046427.tar.xz
linux-0dd6c08a0042ed83037cf5c772d9066e33046427.zip
configfs: configfs_create_dir() has parent dentry in dentry->d_parent
no need to play sick games with parent item, internal mount, etc. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/configfs')
-rw-r--r--fs/configfs/dir.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 54c59a7e37ce..6c560e77965c 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -264,11 +264,13 @@ static int init_symlink(struct inode * inode)
return 0;
}
-static int create_dir(struct config_item * k, struct dentry * p,
- struct dentry * d)
+static int create_dir(struct config_item *k, struct dentry *d)
{
int error;
umode_t mode = S_IFDIR| S_IRWXU | S_IRUGO | S_IXUGO;
+ struct dentry *p = d->d_parent;
+
+ BUG_ON(!k);
error = configfs_dirent_exists(p->d_fsdata, d->d_name.name);
if (!error)
@@ -304,19 +306,7 @@ static int create_dir(struct config_item * k, struct dentry * p,
static int configfs_create_dir(struct config_item * item, struct dentry *dentry)
{
- struct dentry * parent;
- int error = 0;
-
- BUG_ON(!item);
-
- if (item->ci_parent)
- parent = item->ci_parent->ci_dentry;
- else if (configfs_mount)
- parent = configfs_mount->mnt_root;
- else
- return -EFAULT;
-
- error = create_dir(item,parent,dentry);
+ int error = create_dir(item, dentry);
if (!error)
item->ci_dentry = dentry;
return error;