io_uring: fix bad free in io_sqe_files_register
Subsystems (2)
cover io_uring: fix bad free in io_sqe_files_register
If io_sqe_files_register is called but returns EFAULT or EBADF the io_ring_ctx user_files member is cleaned up, but a following call to io_sqe_files_unregister will double-free.
Dan Robertson (1):
io_uring: fix bad free in io_sqe_files_register
fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
Signature · 1 line
2.21.0
PATCH 1/1 io_uring: fix bad free in io_sqe_files_register
Given bad input to the io_uring_register syscall the io_ring_ctx user_files member is cleaned up in io_sqe_files_register, but a following call to io_uring_release will result in a double-free.
--- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
@@ -2215,6 +2215,7 @@ static int io_sqe_files_register(struct io_ring_ctx *ctx, void __user *arg,fput (ctx->user_files[i]);kfree (ctx->user_files); + ctx->user_files =NULL ; ctx->nr_user_files =0 ;return ret; }
Signature · 1 line
2.21.0
Jens Axboe
maintainerQuoted 3 lines · Dan Robertson
Given bad input to the
io_uring_registersyscall theio_ring_ctxuser_filesmember is cleaned up inio_sqe_files_register, but a following call toio_uring_releasewill result in a double-free.
This was already fixed for -rc5 last week, in this commit:
commit 25adf50fe25d506d3fc12070a5ff4be858a1ac1b
Author: Jens Axboe <[email protected]> Date: Wed Apr 3 09:52:40 2019 -0600
io_uring: fix double free in case of fileset regitration failure
Signature · 1 line
Jens Axboe
Awesome! Sorry for the noise.
Cheers,
Dan