aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2024-05-10 11:50:27 +0800
committerJens Axboe <axboe@kernel.dk>2024-05-10 06:09:45 -0600
commit3d8f874bd620ce03f75a5512847586828ab86544 (patch)
tree5a832d22573e3c9a3e402dc7964f863951369ec0
parentd3da8e98592693811c14c31f05380f378411fea1 (diff)
downloadrenesas-drivers-3d8f874bd620ce03f75a5512847586828ab86544.tar.gz
io_uring: fail NOP if non-zero op flags is passed in
The NOP op flags should have been checked from beginning like any other opcode, otherwise NOP may not be extended with the op flags. Given both liburing and Rust io-uring crate always zeros SQE op flags, just ignore users which play raw NOP uring interface without zeroing SQE, because NOP is just for test purpose. Then we can save one NOP2 opcode. Suggested-by: Jens Axboe <axboe@kernel.dk> Fixes: 2b188cc1bb85 ("Add io_uring IO interface") Cc: stable@vger.kernel.org Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20240510035031.78874-2-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/nop.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/io_uring/nop.c b/io_uring/nop.c
index d956599a3c1b8f..1a4e312dfe510a 100644
--- a/io_uring/nop.c
+++ b/io_uring/nop.c
@@ -12,6 +12,8 @@
int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
{
+ if (READ_ONCE(sqe->rw_flags))
+ return -EINVAL;
return 0;
}