projects
/
platform
/
kernel
/
linux-starfive.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
afb7f56
)
io_uring: clean up timeout async_data allocation
author
Pavel Begunkov
<asml.silence@gmail.com>
Sat, 23 Oct 2021 11:14:00 +0000
(12:14 +0100)
committer
Jens Axboe
<axboe@kernel.dk>
Mon, 25 Oct 2021 13:42:35 +0000
(07:42 -0600)
opcode prep functions are one of the first things that are called, we
can't have ->async_data allocated at this point and it's certainly a
bug. Reflect this assumption in io_timeout_prep() and add a WARN_ONCE
just in case.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link:
https://lore.kernel.org/r/75a28ca7dbcc5af8b6cd9092819e8384c24dedd4.1634987320.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
patch
|
blob
|
history
diff --git
a/fs/io_uring.c
b/fs/io_uring.c
index c6f32fcf387b401d31f69e2e23472a848619ddc4..e775529a36d8910beb7286b22a94517f8a2cb9dd 100644
(file)
--- a/
fs/io_uring.c
+++ b/
fs/io_uring.c
@@
-6113,7
+6113,9
@@
static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
if (unlikely(off && !req->ctx->off_timeout_used))
req->ctx->off_timeout_used = true;
- if (!req_has_async_data(req) && io_alloc_async_data(req))
+ if (WARN_ON_ONCE(req_has_async_data(req)))
+ return -EFAULT;
+ if (io_alloc_async_data(req))
return -ENOMEM;
data = req->async_data;