aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-07-21 10:48:15 +0200
committerChristoph Hellwig <hch@lst.de>2020-07-31 08:17:50 +0200
commite24ab0ef689de43649327f54cd1088f3dad25bb3 (patch)
treea881b2211673900bad6cede1129f7840ff628df3 /fs/namei.c
parent41525f56e2564c2feff4fb2824823900efb3a39f (diff)
downloadlinux-e24ab0ef689de43649327f54cd1088f3dad25bb3.tar.gz
fs: push the getname from do_rmdir into the callers
This mirrors do_unlinkat and will make life a little easier for the init code to reuse the whole function with a kernel filename. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 72d4219c93acb..d75a6039ae396 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3720,17 +3720,16 @@ out:
}
EXPORT_SYMBOL(vfs_rmdir);
-long do_rmdir(int dfd, const char __user *pathname)
+long do_rmdir(int dfd, struct filename *name)
{
int error = 0;
- struct filename *name;
struct dentry *dentry;
struct path path;
struct qstr last;
int type;
unsigned int lookup_flags = 0;
retry:
- name = filename_parentat(dfd, getname(pathname), lookup_flags,
+ name = filename_parentat(dfd, name, lookup_flags,
&path, &last, &type);
if (IS_ERR(name))
return PTR_ERR(name);
@@ -3781,7 +3780,7 @@ exit1:
SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
{
- return do_rmdir(AT_FDCWD, pathname);
+ return do_rmdir(AT_FDCWD, getname(pathname));
}
/**
@@ -3926,8 +3925,7 @@ SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
return -EINVAL;
if (flag & AT_REMOVEDIR)
- return do_rmdir(dfd, pathname);
-
+ return do_rmdir(dfd, getname(pathname));
return do_unlinkat(dfd, getname(pathname));
}