From: Pavel Begunkov <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH 2/2] io_uring: fix leaving invalid req->flags
Date: Sat, 20 Feb 2021 01:39:53 +0000 [thread overview]
Message-ID: <67c634daf96050926d32cf9c692e53b9144e6f79.1613785076.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
sqe->flags are subset of req flags, so incorrectly copied may span into
in-kernel flags and wreck havoc, e.g. by setting REQ_F_INFLIGHT.
Fixes: 5be9ad1e4287e ("io_uring: optimise io_init_req() flags setting")
Signed-off-by: Pavel Begunkov <[email protected]>
---
fs/io_uring.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index ce5fccf00367..2bd10f89b837 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6687,8 +6687,10 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
req->result = 0;
/* enforce forwards compatibility on users */
- if (unlikely(sqe_flags & ~SQE_VALID_FLAGS))
+ if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) {
+ req->flags = 0;
return -EINVAL;
+ }
if (unlikely(req->opcode >= IORING_OP_LAST))
return -EINVAL;
--
2.24.0
next prev parent reply other threads:[~2021-02-20 1:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-20 1:39 [PATCH 0/2] random fixes Pavel Begunkov
2021-02-20 1:39 ` [PATCH 1/2] io_uring: wait potential ->release() on resurrect Pavel Begunkov
2021-02-20 3:40 ` Jens Axboe
2021-02-20 3:47 ` Pavel Begunkov
2021-02-20 3:53 ` Jens Axboe
2021-02-20 1:39 ` Pavel Begunkov [this message]
2021-02-20 4:17 ` [PATCH 2/2] io_uring: fix leaving invalid req->flags Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=67c634daf96050926d32cf9c692e53b9144e6f79.1613785076.git.asml.silence@gmail.com \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox