Skip to content

Commit e24ab0e

Browse files
author
Christoph Hellwig
committed
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 <[email protected]>
1 parent 41525f5 commit e24ab0e

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

fs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
6565
long do_mknodat(int dfd, const char __user *filename, umode_t mode,
6666
unsigned int dev);
6767
long do_mkdirat(int dfd, const char __user *pathname, umode_t mode);
68-
long do_rmdir(int dfd, const char __user *pathname);
68+
long do_rmdir(int dfd, struct filename *name);
6969
long do_unlinkat(int dfd, struct filename *name);
7070
long do_symlinkat(const char __user *oldname, int newdfd,
7171
const char __user *newname);

fs/namei.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,17 +3720,16 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
37203720
}
37213721
EXPORT_SYMBOL(vfs_rmdir);
37223722

3723-
long do_rmdir(int dfd, const char __user *pathname)
3723+
long do_rmdir(int dfd, struct filename *name)
37243724
{
37253725
int error = 0;
3726-
struct filename *name;
37273726
struct dentry *dentry;
37283727
struct path path;
37293728
struct qstr last;
37303729
int type;
37313730
unsigned int lookup_flags = 0;
37323731
retry:
3733-
name = filename_parentat(dfd, getname(pathname), lookup_flags,
3732+
name = filename_parentat(dfd, name, lookup_flags,
37343733
&path, &last, &type);
37353734
if (IS_ERR(name))
37363735
return PTR_ERR(name);
@@ -3781,7 +3780,7 @@ long do_rmdir(int dfd, const char __user *pathname)
37813780

37823781
SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
37833782
{
3784-
return do_rmdir(AT_FDCWD, pathname);
3783+
return do_rmdir(AT_FDCWD, getname(pathname));
37853784
}
37863785

37873786
/**
@@ -3926,8 +3925,7 @@ SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
39263925
return -EINVAL;
39273926

39283927
if (flag & AT_REMOVEDIR)
3929-
return do_rmdir(dfd, pathname);
3930-
3928+
return do_rmdir(dfd, getname(pathname));
39313929
return do_unlinkat(dfd, getname(pathname));
39323930
}
39333931

include/linux/syscalls.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,11 +1281,11 @@ static inline long ksys_unlink(const char __user *pathname)
12811281
return do_unlinkat(AT_FDCWD, getname(pathname));
12821282
}
12831283

1284-
extern long do_rmdir(int dfd, const char __user *pathname);
1284+
long do_rmdir(int dfd, struct filename *name);
12851285

12861286
static inline long ksys_rmdir(const char __user *pathname)
12871287
{
1288-
return do_rmdir(AT_FDCWD, pathname);
1288+
return do_rmdir(AT_FDCWD, getname(pathname));
12891289
}
12901290

12911291
extern long do_mkdirat(int dfd, const char __user *pathname, umode_t mode);

0 commit comments

Comments
 (0)