diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-11-28 10:29:58 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-01-20 11:51:38 +0100 |
commit | 0c7df8c241ff066b19782100f6bfc288144d7a38 (patch) | |
tree | 5c40d3c80f233f010538a704d1cf59c1c0e93c00 /block | |
parent | 75cc56afb28b0f113f79d8906f7fed9100cea288 (diff) | |
download | linux-stable-0c7df8c241ff066b19782100f6bfc288144d7a38.tar.gz linux-stable-0c7df8c241ff066b19782100f6bfc288144d7a38.tar.bz2 linux-stable-0c7df8c241ff066b19782100f6bfc288144d7a38.zip |
io_uring: use fget/fput consistently
[ Upstream commit 73363c262d6a7d26063da96610f61baf69a70f7c ]
Normally within a syscall it's fine to use fdget/fdput for grabbing a
file from the file table, and it's fine within io_uring as well. We do
that via io_uring_enter(2), io_uring_register(2), and then also for
cancel which is invoked from the latter. io_uring cannot close its own
file descriptors as that is explicitly rejected, and for the cancel
side of things, the file itself is just used as a lookup cookie.
However, it is more prudent to ensure that full references are always
grabbed. For anything threaded, either explicitly in the application
itself or through use of the io-wq worker threads, this is what happens
anyway. Generalize it and use fget/fput throughout.
Also see the below link for more details.
Link: https://lore.kernel.org/io-uring/CAG48ez1htVSO3TqmrF8QcX2WFuYTRM-VZ_N10i-VZgbtg=NNqw@mail.gmail.com/
Suggested-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions