diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-11-28 20:29:58 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-11-28 21:56:29 +0300 |
commit | 73363c262d6a7d26063da96610f61baf69a70f7c (patch) | |
tree | 392b611882deb8cde1d43d8d81435d74ff20eb17 /include | |
parent | 5cf4f52e6d8aa2d3b7728f568abbf9d42a3af252 (diff) | |
download | linux-73363c262d6a7d26063da96610f61baf69a70f7c.tar.xz |
io_uring: use fget/fput consistently
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>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions