Skip to content

Commit

Permalink
io_uring: fail NOP if non-zero op flags is passed in
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 2b188cc ("Add io_uring IO interface")
Cc: [email protected]
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Ming Lei authored and axboe committed May 10, 2024
1 parent d3da8e9 commit 3d8f874
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions io_uring/nop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 3d8f874

Please sign in to comment.