Skip to content

Commit 3d8f874

Browse files
Ming Leiaxboe
authored andcommitted
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 <[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]>
1 parent d3da8e9 commit 3d8f874

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/nop.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
int io_nop_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
1414
{
15+
if (READ_ONCE(sqe->rw_flags))
16+
return -EINVAL;
1517
return 0;
1618
}
1719

0 commit comments

Comments
 (0)