lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  5 Mar 2021 09:32:38 +0000
From:   Colin King <colin.king@...onical.com>
To:     Jens Axboe <axboe@...nel.dk>,
        Pavel Begunkov <asml.silence@...il.com>,
        io-uring@...r.kernel.org
Cc:     kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] io_uring: Fix error returns when create_io_thread fails

From: Colin Ian King <colin.king@...onical.com>

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@...onical.com>
---
 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ