diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-12-28 11:00:29 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-12-28 11:00:29 -0800 |
| commit | d19a3ee573e31d74d5d13595ec515660ac8a3800 (patch) | |
| tree | a04da5aa79291d4e1026e89f1cd47447f18fdbb1 | |
| parent | e51da4a2324e595af54a0cb3b4c35eed87548de4 (diff) | |
| parent | e33ac68e5e21ec1292490dfe061e75c0dbdd3bd4 (diff) | |
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
| -rw-r--r-- | io_uring/sqpoll.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/io_uring/sqpoll.c b/io_uring/sqpoll.c index 6df5e649c413..9e5bd79fd2b5 100644 --- a/io_uring/sqpoll.c +++ b/io_uring/sqpoll.c @@ -405,6 +405,7 @@ void io_sqpoll_wait_sq(struct io_ring_ctx *ctx) __cold int io_sq_offload_create(struct io_ring_ctx *ctx, struct io_uring_params *p) { + struct task_struct *task_to_put = NULL; int ret; /* Retain compatibility with failing for an invalid attach attempt */ @@ -480,6 +481,7 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx, } sqd->thread = tsk; + task_to_put = get_task_struct(tsk); ret = io_uring_alloc_task_context(tsk, ctx); wake_up_new_task(tsk); if (ret) @@ -490,11 +492,15 @@ __cold int io_sq_offload_create(struct io_ring_ctx *ctx, goto err; } + if (task_to_put) + put_task_struct(task_to_put); return 0; err_sqpoll: complete(&ctx->sq_data->exited); err: io_sq_thread_finish(ctx); + if (task_to_put) + put_task_struct(task_to_put); return ret; } |
