]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
io_uring/openclose: fix io_pipe_fixed() slot tracking for specific slots
authorJens Axboe <axboe@kernel.dk>
Wed, 11 Feb 2026 22:12:13 +0000 (15:12 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 12 Feb 2026 03:31:21 +0000 (20:31 -0700)
commitf4d0668b38d8784f33a9a36c72ed5d0078247538
tree881242fd149215a605ae6da97e839b1b3962f0c9
parenta6bded921ed35f21b3f6bd8e629bf488499ca442
io_uring/openclose: fix io_pipe_fixed() slot tracking for specific slots

__io_fixed_fd_install() returns 0 on success for non-alloc mode
(specific slot), not the slot index. io_pipe_fixed() used this return
value directly as the slot index in fds[], which can cause the reported
values returned via copy_to_user() to be incorrect, or the error path
operating on the incorrect direct descriptor.

Fix by computing the actual 0-based slot index (slot - 1) for specific
slot mode, while preserving the existing behavior for auto-alloc mode
where __io_fixed_fd_install() already returns the allocated index.

Cc: stable@vger.kernel.org
Fixes: 53db8a71ecb4 ("io_uring: add support for IORING_OP_PIPE")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/openclose.c