mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
io_uring: ensure fput() called correspondingly when direct install fails
io_fixed_fd_install() may fail for short of free fixed file bitmap, in this case, need to call fput() correspondingly. Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/20220527025400.51048-1-xiaoguang.wang@linux.alibaba.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
fa82dd105b
commit
8c71fe7502
1 changed files with 5 additions and 0 deletions
|
@ -5438,6 +5438,10 @@ static int io_file_bitmap_get(struct io_ring_ctx *ctx)
|
||||||
return -ENFILE;
|
return -ENFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note when io_fixed_fd_install() returns error value, it will ensure
|
||||||
|
* fput() is called correspondingly.
|
||||||
|
*/
|
||||||
static int io_fixed_fd_install(struct io_kiocb *req, unsigned int issue_flags,
|
static int io_fixed_fd_install(struct io_kiocb *req, unsigned int issue_flags,
|
||||||
struct file *file, unsigned int file_slot)
|
struct file *file, unsigned int file_slot)
|
||||||
{
|
{
|
||||||
|
@ -5450,6 +5454,7 @@ static int io_fixed_fd_install(struct io_kiocb *req, unsigned int issue_flags,
|
||||||
ret = io_file_bitmap_get(ctx);
|
ret = io_file_bitmap_get(ctx);
|
||||||
if (unlikely(ret < 0)) {
|
if (unlikely(ret < 0)) {
|
||||||
io_ring_submit_unlock(ctx, issue_flags);
|
io_ring_submit_unlock(ctx, issue_flags);
|
||||||
|
fput(file);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue