diff options
Diffstat (limited to 'fs/configfs/symlink.c')
-rw-r--r-- | fs/configfs/symlink.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index 0f3eb41d9201..cc9f2546ea4a 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
@@ -110,13 +110,13 @@ out: | |||
110 | 110 | ||
111 | 111 | ||
112 | static int get_target(const char *symname, struct path *path, | 112 | static int get_target(const char *symname, struct path *path, |
113 | struct config_item **target) | 113 | struct config_item **target, struct super_block *sb) |
114 | { | 114 | { |
115 | int ret; | 115 | int ret; |
116 | 116 | ||
117 | ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path); | 117 | ret = kern_path(symname, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, path); |
118 | if (!ret) { | 118 | if (!ret) { |
119 | if (path->dentry->d_sb == configfs_sb) { | 119 | if (path->dentry->d_sb == sb) { |
120 | *target = configfs_get_config_item(path->dentry); | 120 | *target = configfs_get_config_item(path->dentry); |
121 | if (!*target) { | 121 | if (!*target) { |
122 | ret = -ENOENT; | 122 | ret = -ENOENT; |
@@ -141,10 +141,6 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna | |||
141 | struct config_item *target_item = NULL; | 141 | struct config_item *target_item = NULL; |
142 | struct config_item_type *type; | 142 | struct config_item_type *type; |
143 | 143 | ||
144 | ret = -EPERM; /* What lack-of-symlink returns */ | ||
145 | if (dentry->d_parent == configfs_sb->s_root) | ||
146 | goto out; | ||
147 | |||
148 | sd = dentry->d_parent->d_fsdata; | 144 | sd = dentry->d_parent->d_fsdata; |
149 | /* | 145 | /* |
150 | * Fake invisibility if dir belongs to a group/default groups hierarchy | 146 | * Fake invisibility if dir belongs to a group/default groups hierarchy |
@@ -162,7 +158,7 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna | |||
162 | !type->ct_item_ops->allow_link) | 158 | !type->ct_item_ops->allow_link) |
163 | goto out_put; | 159 | goto out_put; |
164 | 160 | ||
165 | ret = get_target(symname, &path, &target_item); | 161 | ret = get_target(symname, &path, &target_item, dentry->d_sb); |
166 | if (ret) | 162 | if (ret) |
167 | goto out_put; | 163 | goto out_put; |
168 | 164 | ||
@@ -198,8 +194,6 @@ int configfs_unlink(struct inode *dir, struct dentry *dentry) | |||
198 | if (!(sd->s_type & CONFIGFS_ITEM_LINK)) | 194 | if (!(sd->s_type & CONFIGFS_ITEM_LINK)) |
199 | goto out; | 195 | goto out; |
200 | 196 | ||
201 | BUG_ON(dentry->d_parent == configfs_sb->s_root); | ||
202 | |||
203 | sl = sd->s_element; | 197 | sl = sd->s_element; |
204 | 198 | ||
205 | parent_item = configfs_get_config_item(dentry->d_parent); | 199 | parent_item = configfs_get_config_item(dentry->d_parent); |