]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: check that we have a file table when allocating update slots
authorJens Axboe <axboe@kernel.dk>
Sat, 9 Jul 2022 13:02:10 +0000 (07:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 9 Jul 2022 13:02:10 +0000 (07:02 -0600)
commita5c1d5cbd8a417a3eb91553712ba262b2527e864
tree21d14a028c00edba012092a465d5964fb25ff37b
parent4af73a3cde7d111f3c49c355a4367b9ca30ed435
io_uring: check that we have a file table when allocating update slots

If IORING_FILE_INDEX_ALLOC is set asking for an allocated slot, the
helper doesn't check if we actually have a file table or not. The non
alloc path does do that correctly, and returns -ENXIO if we haven't set
one up.

Do the same for the allocated path, avoiding a NULL pointer dereference
when trying to find a free bit.

Fixes: 50b5945e49b4 ("io_uring: let IORING_OP_FILES_UPDATE support choosing fixed file slots")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c