]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: remove 'fname' from io_open structure
authorJens Axboe <axboe@kernel.dk>
Thu, 9 Jan 2020 00:47:02 +0000 (17:47 -0700)
committerJens Axboe <axboe@kernel.dk>
Tue, 21 Jan 2020 00:04:04 +0000 (17:04 -0700)
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: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index d8d252b4c9be6f042ab3c145a5fb24545406428f..3a57ea98fe3ae92c1491bd0a4f005f3a9d375645 100644 (file)
@@ -392,7 +392,6 @@ struct io_open {
        union {
                unsigned                mask;
        };
-       const char __user               *fname;
        struct filename                 *filename;
        struct statx __user             *buffer;
        struct open_how                 how;
@@ -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.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.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;
@@ -2593,6 +2593,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;
 
@@ -2601,14 +2602,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.how.flags = READ_ONCE(sqe->statx_flags);
 
        if (vfs_stat_set_lookup_flags(&lookup_flags, req->open.how.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;