Skip to content
Commit 9e3aa61a authored by Jens Axboe's avatar Jens Axboe
Browse files

io_uring: ensure we return -EINVAL on unknown opcode



If we submit an unknown opcode and have fd == -1, io_op_needs_file()
will return true as we default to needing a file. Then when we go and
assign the file, we find the 'fd' invalid and return -EBADF. We really
should be returning -EINVAL for that case, as we normally do for
unsupported opcodes.

Change io_op_needs_file() to have the following return values:

0   - does not need a file
1   - does need a file
< 0 - error value

and use this to pass back the right value for this invalid case.

Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 10d59345
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment