mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
vfs: retire user_path_at_empty and drop empty arg from getname_flags
No users after do_readlinkat started doing the job on its own. Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://lore.kernel.org/r/20240604155257.109500-3-mjguzik@gmail.com Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
969ce92da3
commit
dff60734fc
@ -448,7 +448,7 @@ SYSCALL_DEFINE5(fsconfig,
|
||||
fallthrough;
|
||||
case FSCONFIG_SET_PATH:
|
||||
param.type = fs_value_is_filename;
|
||||
param.name = getname_flags(_value, lookup_flags, NULL);
|
||||
param.name = getname_flags(_value, lookup_flags);
|
||||
if (IS_ERR(param.name)) {
|
||||
ret = PTR_ERR(param.name);
|
||||
goto out_key;
|
||||
|
16
fs/namei.c
16
fs/namei.c
@ -126,7 +126,7 @@
|
||||
#define EMBEDDED_NAME_MAX (PATH_MAX - offsetof(struct filename, iname))
|
||||
|
||||
struct filename *
|
||||
getname_flags(const char __user *filename, int flags, int *empty)
|
||||
getname_flags(const char __user *filename, int flags)
|
||||
{
|
||||
struct filename *result;
|
||||
char *kname;
|
||||
@ -190,8 +190,6 @@ getname_flags(const char __user *filename, int flags, int *empty)
|
||||
atomic_set(&result->refcnt, 1);
|
||||
/* The empty path is special. */
|
||||
if (unlikely(!len)) {
|
||||
if (empty)
|
||||
*empty = 1;
|
||||
if (!(flags & LOOKUP_EMPTY)) {
|
||||
putname(result);
|
||||
return ERR_PTR(-ENOENT);
|
||||
@ -209,13 +207,13 @@ getname_uflags(const char __user *filename, int uflags)
|
||||
{
|
||||
int flags = (uflags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0;
|
||||
|
||||
return getname_flags(filename, flags, NULL);
|
||||
return getname_flags(filename, flags);
|
||||
}
|
||||
|
||||
struct filename *
|
||||
getname(const char __user * filename)
|
||||
{
|
||||
return getname_flags(filename, 0, NULL);
|
||||
return getname_flags(filename, 0);
|
||||
}
|
||||
|
||||
struct filename *
|
||||
@ -2922,16 +2920,16 @@ int path_pts(struct path *path)
|
||||
}
|
||||
#endif
|
||||
|
||||
int user_path_at_empty(int dfd, const char __user *name, unsigned flags,
|
||||
struct path *path, int *empty)
|
||||
int user_path_at(int dfd, const char __user *name, unsigned flags,
|
||||
struct path *path)
|
||||
{
|
||||
struct filename *filename = getname_flags(name, flags, empty);
|
||||
struct filename *filename = getname_flags(name, flags);
|
||||
int ret = filename_lookup(dfd, filename, flags, path, NULL);
|
||||
|
||||
putname(filename);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(user_path_at_empty);
|
||||
EXPORT_SYMBOL(user_path_at);
|
||||
|
||||
int __check_sticky(struct mnt_idmap *idmap, struct inode *dir,
|
||||
struct inode *inode)
|
||||
|
@ -300,7 +300,7 @@ int vfs_fstatat(int dfd, const char __user *filename,
|
||||
return vfs_fstat(dfd, stat);
|
||||
}
|
||||
|
||||
name = getname_flags(filename, getname_statx_lookup_flags(statx_flags), NULL);
|
||||
name = getname_flags(filename, getname_statx_lookup_flags(statx_flags));
|
||||
ret = vfs_statx(dfd, name, statx_flags, stat, STATX_BASIC_STATS);
|
||||
putname(name);
|
||||
|
||||
@ -496,7 +496,7 @@ static int do_readlinkat(int dfd, const char __user *pathname,
|
||||
return -EINVAL;
|
||||
|
||||
retry:
|
||||
name = getname_flags(pathname, lookup_flags, NULL);
|
||||
name = getname_flags(pathname, lookup_flags);
|
||||
error = filename_lookup(dfd, name, lookup_flags, &path, NULL);
|
||||
if (unlikely(error)) {
|
||||
putname(name);
|
||||
@ -710,7 +710,7 @@ SYSCALL_DEFINE5(statx,
|
||||
int ret;
|
||||
struct filename *name;
|
||||
|
||||
name = getname_flags(filename, getname_statx_lookup_flags(flags), NULL);
|
||||
name = getname_flags(filename, getname_statx_lookup_flags(flags));
|
||||
ret = do_statx(dfd, name, flags, mask, buffer);
|
||||
putname(name);
|
||||
|
||||
|
@ -2701,7 +2701,7 @@ static inline struct file *file_clone_open(struct file *file)
|
||||
}
|
||||
extern int filp_close(struct file *, fl_owner_t id);
|
||||
|
||||
extern struct filename *getname_flags(const char __user *, int, int *);
|
||||
extern struct filename *getname_flags(const char __user *, int);
|
||||
extern struct filename *getname_uflags(const char __user *, int);
|
||||
extern struct filename *getname(const char __user *);
|
||||
extern struct filename *getname_kernel(const char *);
|
||||
|
@ -50,13 +50,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT};
|
||||
|
||||
extern int path_pts(struct path *path);
|
||||
|
||||
extern int user_path_at_empty(int, const char __user *, unsigned, struct path *, int *empty);
|
||||
|
||||
static inline int user_path_at(int dfd, const char __user *name, unsigned flags,
|
||||
struct path *path)
|
||||
{
|
||||
return user_path_at_empty(dfd, name, flags, path, NULL);
|
||||
}
|
||||
extern int user_path_at(int, const char __user *, unsigned, struct path *);
|
||||
|
||||
struct dentry *lookup_one_qstr_excl(const struct qstr *name,
|
||||
struct dentry *base,
|
||||
|
@ -37,8 +37,7 @@ int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
sx->flags = READ_ONCE(sqe->statx_flags);
|
||||
|
||||
sx->filename = getname_flags(path,
|
||||
getname_statx_lookup_flags(sx->flags),
|
||||
NULL);
|
||||
getname_statx_lookup_flags(sx->flags));
|
||||
|
||||
if (IS_ERR(sx->filename)) {
|
||||
int ret = PTR_ERR(sx->filename);
|
||||
|
@ -96,7 +96,7 @@ int io_getxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
|
||||
path = u64_to_user_ptr(READ_ONCE(sqe->addr3));
|
||||
|
||||
ix->filename = getname_flags(path, LOOKUP_FOLLOW, NULL);
|
||||
ix->filename = getname_flags(path, LOOKUP_FOLLOW);
|
||||
if (IS_ERR(ix->filename)) {
|
||||
ret = PTR_ERR(ix->filename);
|
||||
ix->filename = NULL;
|
||||
@ -189,7 +189,7 @@ int io_setxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
||||
|
||||
path = u64_to_user_ptr(READ_ONCE(sqe->addr3));
|
||||
|
||||
ix->filename = getname_flags(path, LOOKUP_FOLLOW, NULL);
|
||||
ix->filename = getname_flags(path, LOOKUP_FOLLOW);
|
||||
if (IS_ERR(ix->filename)) {
|
||||
ret = PTR_ERR(ix->filename);
|
||||
ix->filename = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user