Skip to content

Commit d19a3ee

Browse files
committed
Merge tag 'io_uring-6.13-20241228' of git://git.kernel.dk/linux
Pull io_uring fix from Jens Axboe: "Just a single fix for a theoretical issue with SQPOLL setup" * tag 'io_uring-6.13-20241228' of git://git.kernel.dk/linux: io_uring/sqpoll: fix sqpoll error handling races
2 parents e51da4a + e33ac68 commit d19a3ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

io_uring/sqpoll.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ void io_sqpoll_wait_sq(struct io_ring_ctx *ctx)
405405
__cold int io_sq_offload_create(struct io_ring_ctx *ctx,
406406
struct io_uring_params *p)
407407
{
408+
struct task_struct *task_to_put = NULL;
408409
int ret;
409410

410411
/* Retain compatibility with failing for an invalid attach attempt */
@@ -480,6 +481,7 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx,
480481
}
481482

482483
sqd->thread = tsk;
484+
task_to_put = get_task_struct(tsk);
483485
ret = io_uring_alloc_task_context(tsk, ctx);
484486
wake_up_new_task(tsk);
485487
if (ret)
@@ -490,11 +492,15 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx,
490492
goto err;
491493
}
492494

495+
if (task_to_put)
496+
put_task_struct(task_to_put);
493497
return 0;
494498
err_sqpoll:
495499
complete(&ctx->sq_data->exited);
496500
err:
497501
io_sq_thread_finish(ctx);
502+
if (task_to_put)
503+
put_task_struct(task_to_put);
498504
return ret;
499505
}
500506

0 commit comments

Comments
 (0)