diff options
author | Pavel Begunkov <asml.silence@gmail.com> | 2023-08-25 00:53:24 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-08-25 01:16:19 +0200 |
commit | 31d3ba924fd86add6d14f9085fdd2f4ec0879631 (patch) | |
tree | 2fa24d94e1e036151b404e4504e963d902f84725 /io_uring | |
parent | io_uring: improve cqe !tracing hot path (diff) | |
download | linux-31d3ba924fd86add6d14f9085fdd2f4ec0879631.tar.xz linux-31d3ba924fd86add6d14f9085fdd2f4ec0879631.zip |
io_uring: cqe init hardening
io_kiocb::cqe stores the completion info which we'll memcpy to
userspace, and we rely on callbacks and other later steps to populate
it with right values. We have never had problems with that, but it would
still be safer to zero it on allocation.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/b16a3b64dde678686460d3c3792c3ba6d3d1bc7a.1692916914.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/io_uring.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index e1a23f4993d3..3e0fe1ebbc10 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -1056,7 +1056,7 @@ static void io_preinit_req(struct io_kiocb *req, struct io_ring_ctx *ctx) req->link = NULL; req->async_data = NULL; /* not necessary, but safer to zero */ - req->cqe.res = 0; + memset(&req->cqe, 0, sizeof(req->cqe)); } static void io_flush_cached_locked_reqs(struct io_ring_ctx *ctx, |