mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
io_uring: fail NOP if non-zero op flags is passed in
commit3d8f874bd6
upstream. 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:2b188cc1bb
("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
63664389b6
commit
6e23457791
1 changed files with 2 additions and 0 deletions
|
@ -2112,6 +2112,8 @@ static int __io_submit_sqe(struct io_ring_ctx *ctx, struct io_kiocb *req,
|
|||
|
||||
switch (req->submit.opcode) {
|
||||
case IORING_OP_NOP:
|
||||
if (READ_ONCE(s->sqe->rw_flags))
|
||||
return -EINVAL;
|
||||
ret = io_nop(req, req->user_data);
|
||||
break;
|
||||
case IORING_OP_READV:
|
||||
|
|
Loading…
Reference in a new issue