io_uring: Fix use-after-free in io_sq_wq_submit_work()
Subsystems (2)
PATCH 1/1 io_uring: Fix use-after-free in io_sq_wq_submit_work()
when ctx->sqo_mm is zero, io_sq_wq_submit_work() frees 'req' without deleting it from 'task_list'. After that, 'req' is accessed in io_ring_ctx_wait_and_kill() which lead to a use-after-free.
Signed-off-by Guoyu Huang <[email protected]>
--- fs/io_uring.c | 1 + 1 file changed, 1 insertion(+)
fs/io_uring.c +1 -0
@@ -2242,6 +2242,7 @@ static void io_sq_wq_submit_work(struct work_struct *work)if (io_sqe_needs_user (sqe) && !cur_mm) {if (!mmget_not_zero (ctx->sqo_mm)) { ret = -EFAULT ; + goto end_req; }else { cur_mm = ctx->sqo_mm;use_mm (cur_mm);
--
2.25.1
Jens Axboe
maintainerQuoted 4 lines · Guoyu Huang
when
ctx->sqo_mmis zero,io_sq_wq_submit_work()frees 'req' without deleting it from 'task_list'. After that, 'req' is accessed inio_ring_ctx_wait_and_kill()which lead to a use-after-free.
This looks like an old one, that affects 5.4 only. I've massaged it to apply on top of another fix, will ask to get it queued up for stable. Thanks!
Signature · 1 line
Jens Axboe