From: Govindarajulu Varadarajan <govind.varadar@gmail.com>
To: io-uring@vger.kernel.org, axboe@kernel.dk
Cc: ming.lei@redhat.com, kbusch@kernel.org, hch@lst.de,
sagi@grimberg.me, miklos@szeredi.hu,
Govindarajulu Varadarajan <govind.varadar@gmail.com>
Subject: [PATCH 2/2] block/ublk_drv: Validate SQE128 flag before accessing the cmd
Date: Thu, 29 Jan 2026 12:13:47 -0800 [thread overview]
Message-ID: <20260129201347.411015-3-govind.varadar@gmail.com> (raw)
In-Reply-To: <20260129201347.411015-1-govind.varadar@gmail.com>
ublk_ctrl_cmd_dump() accesses (header *)sqe->cmd before
IO_URING_F_SQE128 flag check. This could cause out of boundary memory
access.
Move the SQE128 flag check earlier in ublk_ctrl_uring_cmd() to return
-EINVAL immediately if the flag is not set.
Signed-off-by: Govindarajulu Varadarajan <govind.varadar@gmail.com>
---
drivers/block/ublk_drv.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 7c8a23709efa..adeed0af1dee 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -5163,10 +5163,10 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
issue_flags & IO_URING_F_NONBLOCK)
return -EAGAIN;
- ublk_ctrl_cmd_dump(cmd);
-
if (!(issue_flags & IO_URING_F_SQE128))
- goto out;
+ return -EINVAL;
+
+ ublk_ctrl_cmd_dump(cmd);
ret = ublk_check_cmd_op(cmd_op);
if (ret)
--
2.52.0
prev parent reply other threads:[~2026-01-29 20:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 20:13 [PATCH 0/2] io_uring: Add macro to validate SQE cmd size Govindarajulu Varadarajan
2026-01-29 20:13 ` [PATCH 1/2] io_uring: Add size check for sqe->cmd Govindarajulu Varadarajan
2026-01-29 20:19 ` Jens Axboe
2026-01-29 20:48 ` Caleb Sander Mateos
2026-01-30 5:11 ` Christoph Hellwig
2026-01-29 20:13 ` Govindarajulu Varadarajan [this message]
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 \
--in-reply-to=20260129201347.411015-3-govind.varadar@gmail.com \
--to=govind.varadar@gmail.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@kernel.org \
--cc=miklos@szeredi.hu \
--cc=ming.lei@redhat.com \
--cc=sagi@grimberg.me \
/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