io_uring: set table->files[i] to NULL when io_sqe_file_register failed
Subsystems (3)
PATCH 1/1 io_uring: set table->files[i] to NULL when io_sqe_file_register failed
While io_sqe_file_register() failed in __io_sqe_files_update(), table->files[i] still point to the original file which may freed soon, and that will trigger use-after-free problems.
--- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
@@ -7353,6 +7353,7 @@ static int __io_sqe_files_update(struct io_ring_ctx *ctx, table->files[index] = file; err =io_sqe_file_register (ctx, file, i);if (err) { + table->files[index] =NULL ;fput (file);break ; }
Signature · 1 line
1.8.3.1
Quoted 3 lines · Jiufei Xue
While
io_sqe_file_register()failed in__io_sqe_files_update(), table->files[i] still point to the original file which may freed soon, and that will trigger use-after-free problems.
Applied, thanks.
Signature · 1 line
Jens Axboe
missing backport markings on security fix [was: [PATCH] io_uring: set table->files[i] to NULL when io_sqe_file_register failed]
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Jiufei Xue
While
io_sqe_file_register()failed in__io_sqe_files_update(), table->files[i] still point to the original file which may freed soon, and that will trigger use-after-free problems.Applied, thanks.
Shouldn't this have a CC stable tag and a fixes tag on it? AFAICS this is a fix for a UAF that exists since f3bd9dae3708a0ff6b067e766073ffeb853301f9 ("io_uring: fix memleak in __io_sqe_files_update()"), and that commit was marked for stable backporting back to when c3a31e605620 landed, and that commit was introduced in Linux 5.5.
You can see at <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/io_uring.c?h=linux-5.8.y#n6933>
that this security vulnerability currently exists in the stable 5.8
branch.
Jens Axboe
maintainerRe: missing backport markings on security fix [was: [PATCH] io_uring: set table->files[i] to NULL when io_sqe_file_register failed]
Quoted 15 lines · Jann Horn
Quoted 6 lines · Jens Axboe
Quoted 3 lines · Jiufei Xue
While
io_sqe_file_register()failed in__io_sqe_files_update(), table->files[i] still point to the original file which may freed soon, and that will trigger use-after-free problems.Applied, thanks.
Shouldn't this have a CC stable tag and a fixes tag on it? AFAICS this is a fix for a UAF that exists since
f3bd9dae3708a0ff6b067e766073ffeb853301f9("io_uring: fix memleak in__io_sqe_files_update()"), and that commit was marked for stable backporting back to whenc3a31e605620landed, and that commit was introduced in Linux 5.5.
Quoted 3 lines
You can see at <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/fs/io_uring.c?h=linux-5.8.y#n6933>
that this security vulnerability currently exists in the stable 5.8
branch.
I'll mark it for stable, it should have been just like the previous one is.
Signature · 1 line
Jens Axboe