提交 6d31fb7e 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: remove 'fname' from io_open structure

to #26323588

commit f8748881b17dc56b3faa1d30c823f071c56593e5 upstream.

We only use it internally in the prep functions for both statx and
openat, so we don't need it to be persistent across the request.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 ab1ea5a0
...@@ -392,7 +392,6 @@ struct io_open { ...@@ -392,7 +392,6 @@ struct io_open {
union { union {
unsigned mask; unsigned mask;
}; };
const char __user *fname;
struct filename *filename; struct filename *filename;
struct statx __user *buffer; struct statx __user *buffer;
struct open_how how; struct open_how how;
...@@ -2464,6 +2463,7 @@ static int io_fallocate(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -2464,6 +2463,7 @@ static int io_fallocate(struct io_kiocb *req, struct io_kiocb **nxt,
static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{ {
const char __user *fname;
int ret; int ret;
if (sqe->ioprio || sqe->buf_index) if (sqe->ioprio || sqe->buf_index)
...@@ -2471,10 +2471,10 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2471,10 +2471,10 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
req->open.dfd = READ_ONCE(sqe->fd); req->open.dfd = READ_ONCE(sqe->fd);
req->open.how.mode = READ_ONCE(sqe->len); req->open.how.mode = READ_ONCE(sqe->len);
req->open.fname = u64_to_user_ptr(READ_ONCE(sqe->addr)); fname = u64_to_user_ptr(READ_ONCE(sqe->addr));
req->open.how.flags = READ_ONCE(sqe->open_flags); req->open.how.flags = READ_ONCE(sqe->open_flags);
req->open.filename = getname(req->open.fname); req->open.filename = getname(fname);
if (IS_ERR(req->open.filename)) { if (IS_ERR(req->open.filename)) {
ret = PTR_ERR(req->open.filename); ret = PTR_ERR(req->open.filename);
req->open.filename = NULL; req->open.filename = NULL;
...@@ -2590,6 +2590,7 @@ static int io_fadvise(struct io_kiocb *req, struct io_kiocb **nxt, ...@@ -2590,6 +2590,7 @@ static int io_fadvise(struct io_kiocb *req, struct io_kiocb **nxt,
static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{ {
const char __user *fname;
unsigned lookup_flags; unsigned lookup_flags;
int ret; int ret;
...@@ -2598,14 +2599,14 @@ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2598,14 +2599,14 @@ static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
req->open.dfd = READ_ONCE(sqe->fd); req->open.dfd = READ_ONCE(sqe->fd);
req->open.mask = READ_ONCE(sqe->len); req->open.mask = READ_ONCE(sqe->len);
req->open.fname = u64_to_user_ptr(READ_ONCE(sqe->addr)); fname = u64_to_user_ptr(READ_ONCE(sqe->addr));
req->open.buffer = u64_to_user_ptr(READ_ONCE(sqe->addr2)); req->open.buffer = u64_to_user_ptr(READ_ONCE(sqe->addr2));
req->open.how.flags = READ_ONCE(sqe->statx_flags); req->open.how.flags = READ_ONCE(sqe->statx_flags);
if (vfs_stat_set_lookup_flags(&lookup_flags, req->open.how.flags)) if (vfs_stat_set_lookup_flags(&lookup_flags, req->open.how.flags))
return -EINVAL; return -EINVAL;
req->open.filename = getname_flags(req->open.fname, lookup_flags, NULL); req->open.filename = getname_flags(fname, lookup_flags, NULL);
if (IS_ERR(req->open.filename)) { if (IS_ERR(req->open.filename)) {
ret = PTR_ERR(req->open.filename); ret = PTR_ERR(req->open.filename);
req->open.filename = NULL; req->open.filename = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册