diff options
-rw-r--r-- | io_uring/register.c | 6 | ||||
-rw-r--r-- | io_uring/rsrc.c | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/io_uring/register.c b/io_uring/register.c index 05025047d1da..0db181437ae3 100644 --- a/io_uring/register.c +++ b/io_uring/register.c @@ -853,6 +853,8 @@ struct file *io_uring_register_get_file(unsigned int fd, bool registered) return ERR_PTR(-EINVAL); fd = array_index_nospec(fd, IO_RINGFD_REG_MAX); file = tctx->registered_rings[fd]; + if (file) + get_file(file); } else { file = fget(fd); } @@ -919,7 +921,7 @@ SYSCALL_DEFINE4(io_uring_register, unsigned int, fd, unsigned int, opcode, trace_io_uring_register(ctx, opcode, ctx->file_table.data.nr, ctx->buf_table.nr, ret); mutex_unlock(&ctx->uring_lock); - if (!use_registered_ring) - fput(file); + + fput(file); return ret; } diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index a1c7c8db5545..b5e47030764e 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -1079,7 +1079,6 @@ int io_register_clone_buffers(struct io_ring_ctx *ctx, void __user *arg) if (src_ctx != ctx) mutex_unlock(&src_ctx->uring_lock); - if (!registered_src) - fput(file); + fput(file); return ret; } |