public inbox for [email protected]
 help / color / mirror / Atom feed
From: Colin King <[email protected]>
To: Jens Axboe <[email protected]>,
	Pavel Begunkov <[email protected]>,
	[email protected]
Cc: [email protected], [email protected]
Subject: [PATCH][next] io_uring: Fix a read of ununitialized pointer tctx
Date: Fri,  3 Sep 2021 12:35:35 +0100	[thread overview]
Message-ID: <[email protected]> (raw)

From: Colin Ian King <[email protected]>

In the unlikely case where ctx->flags & IORING_SETUP_SQPOLL is true
and sqd is NULL the pointer tctx is not assigned a valid value and
can contain a garbage value when it is dereferenced. Fix this by
initializing it to NULL.

Addresses-Coverity: ("Uninitialized pointer read")
Fixes: 9e30726065ea ("io_uring: ensure IORING_REGISTER_IOWQ_MAX_WORKERS works with SQPOLL")
Signed-off-by: Colin Ian King <[email protected]>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 132dd38e89ce..843362bebd8c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10525,7 +10525,7 @@ static int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
 					void __user *arg)
 {
 	struct io_sq_data *sqd = NULL;
-	struct io_uring_task *tctx;
+	struct io_uring_task *tctx = NULL;
 	__u32 new_count[2];
 	int i, ret;
 
-- 
2.32.0


             reply	other threads:[~2021-09-03 11:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-03 11:35 Colin King [this message]
2021-09-03 12:16 ` [PATCH][next] io_uring: Fix a read of ununitialized pointer tctx Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox