提交 7b207842 编写于 作者: J Jens Axboe 提交者: Cheng Jian

io_uring: remove 'fname' from io_open structure

mainline inclusion
from mainline-5.6-rc1
commit f8748881
category: feature
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=27
CVE: NA
---------------------------

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>

Conflicts:
	fs/io_uring.c
[ commit c12cedf2("io_uring: add 'struct open_how'
 to the openat request context" is not applied ]
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 02aaaf19
......@@ -393,7 +393,6 @@ struct io_open {
umode_t mode;
unsigned mask;
};
const char __user *fname;
struct filename *filename;
struct statx __user *buffer;
int flags;
......@@ -2467,6 +2466,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)
{
const char __user *fname;
int ret;
if (sqe->ioprio || sqe->buf_index)
......@@ -2474,10 +2474,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.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.flags = READ_ONCE(sqe->open_flags);
req->open.filename = getname(req->open.fname);
req->open.filename = getname(fname);
if (IS_ERR(req->open.filename)) {
ret = PTR_ERR(req->open.filename);
req->open.filename = NULL;
......@@ -2591,6 +2591,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)
{
const char __user *fname;
unsigned lookup_flags;
int ret;
......@@ -2599,14 +2600,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.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.flags = READ_ONCE(sqe->statx_flags);
if (vfs_stat_set_lookup_flags(&lookup_flags, req->open.flags))
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)) {
ret = PTR_ERR(req->open.filename);
req->open.filename = NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册