public inbox for [email protected]
 help / color / mirror / Atom feed
From: Stefan Roesch <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>
Subject: [PATCH v1 1/5] fs: make user_path_at_empty() take a struct filename
Date: Mon, 29 Nov 2021 14:12:53 -0800	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

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 <[email protected]>
---
 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


  reply	other threads:[~2021-11-29 22:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 22:12 [PATCH v1 0/5] io_uring: add xattr support Stefan Roesch
2021-11-29 22:12 ` Stefan Roesch [this message]
2021-11-30  2:09   ` [PATCH v1 1/5] fs: make user_path_at_empty() take a struct filename kernel test robot
2021-11-29 22:12 ` [PATCH v1 2/5] fs: split off setxattr_setup function from setxattr Stefan Roesch
2021-11-29 22:12 ` [PATCH v1 3/5] fs: split off the vfs_getxattr from getxattr Stefan Roesch
2021-11-29 22:12 ` [PATCH v1 4/5] io_uring: add fsetxattr and setxattr support Stefan Roesch
2021-11-29 22:12 ` [PATCH v1 5/5] io_uring: add fgetxattr and getxattr support Stefan Roesch
2021-11-30  1:08 ` [PATCH v1 0/5] io_uring: add xattr support Clay Harris
2021-11-30  3:16   ` Andreas Dilger
2021-11-30  6:37     ` Clay Harris
2021-11-30  6:53       ` Clay Harris
2021-11-30 11:40         ` Clay Harris
2021-11-30  7:19     ` Dave Chinner
2021-12-01  6:16     ` Stefan Roesch
2021-12-01  6:07   ` Stefan Roesch
2021-12-01  7:46     ` Clay Harris
2021-12-01 13:14       ` Christian Brauner
2021-12-01 12:19     ` Stefan Metzmacher
2021-12-01 19:52       ` Clay Harris
2021-12-01 20:05         ` Andreas Dilger
2021-12-03 17:58       ` Stefan Roesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox