• Jens Axboe's avatar
    io_uring: ensure we return -EINVAL on unknown opcode · 9e3aa61a
    Jens Axboe authored
    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>
    9e3aa61a
io_uring.c 125 KB