[PATCH][next] io_uring: Fix error returns when create_io_thread fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

The error return when create_io_thread calls fail is not using the
error return code from the returned pointer. Fix this by using
the error code in PTR_ERR(tsk).

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: c3c9a3194bd0 ("io_uring: move to using create_io_thread()")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
 fs/io_uring.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index b52ef6df4aac..59b024dba4dc 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7787,7 +7787,7 @@ static int io_sq_thread_fork(struct io_sq_data *sqd, struct io_ring_ctx *ctx)
 	sqd->task_pid = current->pid;
 	tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
 	if (IS_ERR(tsk))
-		return ret;
+		return PTR_ERR(tsk);
 	ret = io_uring_alloc_task_context(tsk, ctx);
 	if (ret)
 		set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
@@ -7859,8 +7859,10 @@ static int io_sq_offload_create(struct io_ring_ctx *ctx,
 
 		sqd->task_pid = current->pid;
 		tsk = create_io_thread(io_sq_thread, sqd, NUMA_NO_NODE);
-		if (IS_ERR(tsk))
+		if (IS_ERR(tsk)) {
+			ret = PTR_ERR(tsk);
 			goto err;
+		}
 		ret = io_uring_alloc_task_context(tsk, ctx);
 		if (ret)
 			set_bit(IO_SQ_THREAD_SHOULD_STOP, &sqd->state);
-- 
2.30.0




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux