diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2020-09-06 00:45:47 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2020-09-30 20:32:33 -0600 |
commit | ab0b196ce5551a093388bb2ceace30df7891051c (patch) | |
tree | bc639f1ec26c75321dd6136b523f8ed6f4cd0459 /fs/io_uring.c | |
parent | afb87658f89b65e067334e06d833ccd859e659e6 (diff) | |
download | lwn-ab0b196ce5551a093388bb2ceace30df7891051c.tar.gz lwn-ab0b196ce5551a093388bb2ceace30df7891051c.zip |
io_uring: fix overlapped memcpy in io_req_map_rw()
When io_req_map_rw() is called from io_rw_prep_async(), it memcpy()
iorw->iter into itself. Even though it doesn't lead to an error, such a
memcpy()'s aliasing rules violation is considered to be a bad practise.
Inline io_req_map_rw() into io_rw_prep_async(). We don't really need any
remapping there, so it's much simpler than the generic implementation.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index bc7028d9e6f9..ed7032bb76bf 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3071,7 +3071,10 @@ static inline int io_rw_prep_async(struct io_kiocb *req, int rw, if (unlikely(ret < 0)) return ret; - io_req_map_rw(req, iov, iorw->fast_iov, &iorw->iter); + iorw->bytes_done = 0; + iorw->free_iovec = iov; + if (iov) + req->flags |= REQ_F_NEED_CLEANUP; return 0; } |