Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fs: expose do_unlinkat for built-in callers

And make it take a struct filename instead of a user pointer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

authored by

Christoph Hellwig and committed by
Al Viro
da2f1362 e145b35b

+6 -7
+1
fs/internal.h
··· 55 55 extern int user_path_mountpoint_at(int, const char __user *, unsigned int, struct path *); 56 56 extern int vfs_path_lookup(struct dentry *, struct vfsmount *, 57 57 const char *, unsigned int, struct path *); 58 + long do_unlinkat(int dfd, struct filename *name); 58 59 59 60 /* 60 61 * namespace.c
+5 -7
fs/namei.c
··· 4009 4009 * writeout happening, and we don't want to prevent access to the directory 4010 4010 * while waiting on the I/O. 4011 4011 */ 4012 - static long do_unlinkat(int dfd, const char __user *pathname) 4012 + long do_unlinkat(int dfd, struct filename *name) 4013 4013 { 4014 4014 int error; 4015 - struct filename *name; 4016 4015 struct dentry *dentry; 4017 4016 struct path path; 4018 4017 struct qstr last; ··· 4020 4021 struct inode *delegated_inode = NULL; 4021 4022 unsigned int lookup_flags = 0; 4022 4023 retry: 4023 - name = filename_parentat(dfd, getname(pathname), lookup_flags, 4024 - &path, &last, &type); 4024 + name = filename_parentat(dfd, name, lookup_flags, &path, &last, &type); 4025 4025 if (IS_ERR(name)) 4026 4026 return PTR_ERR(name); 4027 4027 ··· 4062 4064 mnt_drop_write(path.mnt); 4063 4065 exit1: 4064 4066 path_put(&path); 4065 - putname(name); 4066 4067 if (retry_estale(error, lookup_flags)) { 4067 4068 lookup_flags |= LOOKUP_REVAL; 4068 4069 inode = NULL; 4069 4070 goto retry; 4070 4071 } 4072 + putname(name); 4071 4073 return error; 4072 4074 4073 4075 slashes: ··· 4088 4090 if (flag & AT_REMOVEDIR) 4089 4091 return do_rmdir(dfd, pathname); 4090 4092 4091 - return do_unlinkat(dfd, pathname); 4093 + return do_unlinkat(dfd, getname(pathname)); 4092 4094 } 4093 4095 4094 4096 SYSCALL_DEFINE1(unlink, const char __user *, pathname) 4095 4097 { 4096 - return do_unlinkat(AT_FDCWD, pathname); 4098 + return do_unlinkat(AT_FDCWD, getname(pathname)); 4097 4099 } 4098 4100 4099 4101 int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)