aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-12-11 12:10:09 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:50:04 -0500
commit9e790bd65ce4cbfdff305a57b67b1a2cbe5d4335 (patch)
treeab788cbbbbb2a3367b28f0434206e8857cc3fe4d /fs/namei.c
parent442e31ca5a49e398351b2954b51f578353fdf210 (diff)
vfs: add a flags argument to user_path_parent
...so we can pass in LOOKUP_REVAL. For now, nothing does yet. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 6868699272bf..19190618695f 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2175,15 +2175,19 @@ int user_path_at(int dfd, const char __user *name, unsigned flags,
2175 * path-walking is complete. 2175 * path-walking is complete.
2176 */ 2176 */
2177static struct filename * 2177static struct filename *
2178user_path_parent(int dfd, const char __user *path, struct nameidata *nd) 2178user_path_parent(int dfd, const char __user *path, struct nameidata *nd,
2179 unsigned int flags)
2179{ 2180{
2180 struct filename *s = getname(path); 2181 struct filename *s = getname(path);
2181 int error; 2182 int error;
2182 2183
2184 /* only LOOKUP_REVAL is allowed in extra flags */
2185 flags &= LOOKUP_REVAL;
2186
2183 if (IS_ERR(s)) 2187 if (IS_ERR(s))
2184 return s; 2188 return s;
2185 2189
2186 error = filename_lookup(dfd, s, LOOKUP_PARENT, nd); 2190 error = filename_lookup(dfd, s, flags | LOOKUP_PARENT, nd);
2187 if (error) { 2191 if (error) {
2188 putname(s); 2192 putname(s);
2189 return ERR_PTR(error); 2193 return ERR_PTR(error);
@@ -3336,7 +3340,7 @@ static long do_rmdir(int dfd, const char __user *pathname)
3336 struct dentry *dentry; 3340 struct dentry *dentry;
3337 struct nameidata nd; 3341 struct nameidata nd;
3338 3342
3339 name = user_path_parent(dfd, pathname, &nd); 3343 name = user_path_parent(dfd, pathname, &nd, 0);
3340 if (IS_ERR(name)) 3344 if (IS_ERR(name))
3341 return PTR_ERR(name); 3345 return PTR_ERR(name);
3342 3346
@@ -3432,7 +3436,7 @@ static long do_unlinkat(int dfd, const char __user *pathname)
3432 struct nameidata nd; 3436 struct nameidata nd;
3433 struct inode *inode = NULL; 3437 struct inode *inode = NULL;
3434 3438
3435 name = user_path_parent(dfd, pathname, &nd); 3439 name = user_path_parent(dfd, pathname, &nd, 0);
3436 if (IS_ERR(name)) 3440 if (IS_ERR(name))
3437 return PTR_ERR(name); 3441 return PTR_ERR(name);
3438 3442
@@ -3827,13 +3831,13 @@ SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
3827 struct filename *to; 3831 struct filename *to;
3828 int error; 3832 int error;
3829 3833
3830 from = user_path_parent(olddfd, oldname, &oldnd); 3834 from = user_path_parent(olddfd, oldname, &oldnd, 0);
3831 if (IS_ERR(from)) { 3835 if (IS_ERR(from)) {
3832 error = PTR_ERR(from); 3836 error = PTR_ERR(from);
3833 goto exit; 3837 goto exit;
3834 } 3838 }
3835 3839
3836 to = user_path_parent(newdfd, newname, &newnd); 3840 to = user_path_parent(newdfd, newname, &newnd, 0);
3837 if (IS_ERR(to)) { 3841 if (IS_ERR(to)) {
3838 error = PTR_ERR(to); 3842 error = PTR_ERR(to);
3839 goto exit1; 3843 goto exit1;