Summary: - Changes the user_path_at_empty function to take a filename struct instead of an user character pointer. - It also includes the necessary changes in stat.c and namei.c to call the user_path_at_empty function. Signed-off-by: Stefan Roesch <shr@xxxxxx> --- fs/namei.c | 5 ++--- fs/stat.c | 7 ++++++- include/linux/namei.h | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 1f9d2187c765..baf34cde9ecd 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2794,10 +2794,9 @@ 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_empty(int dfd, struct filename *filename, unsigned flags, + struct path *path) { - struct filename *filename = getname_flags(name, flags, empty); int ret = filename_lookup(dfd, filename, flags, path, NULL); putname(filename); diff --git a/fs/stat.c b/fs/stat.c index 28d2020ba1f4..d8752c103062 100644 --- a/fs/stat.c +++ b/fs/stat.c @@ -435,12 +435,17 @@ static int do_readlinkat(int dfd, const char __user *pathname, int error; int empty = 0; unsigned int lookup_flags = LOOKUP_EMPTY; + struct filename *filename; if (bufsiz <= 0) return -EINVAL; retry: - error = user_path_at_empty(dfd, pathname, lookup_flags, &path, &empty); + filename = getname_flags(pathname, lookup_flags, &empty); + if (IS_ERR(filename)) + return PTR_ERR(filename); + + error = user_path_at_empty(dfd, filename, lookup_flags, &path); if (!error) { struct inode *inode = d_backing_inode(path.dentry); diff --git a/include/linux/namei.h b/include/linux/namei.h index e89329bb3134..dc1ae29478b0 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h @@ -49,12 +49,12 @@ 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); +extern int user_path_at_empty(int, struct filename *, unsigned, struct path *); 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); + return user_path_at_empty(dfd, getname_flags(name, flags, NULL), flags, path); } extern int kern_path(const char *, unsigned, struct path *); -- 2.30.2