linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe
@ 2020-08-13  6:56 Liu Yong
  2020-08-13 14:56 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Yong @ 2020-08-13  6:56 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, linux-kernel, linux-fsdevel

the commit <a4d61e66ee4a> ("<io_uring: prevent re-read of sqe->opcode>") 
caused another vulnerability. After io_get_req(), the sqe_submit struct 
in req is not initialized, but the following code defaults that 
req->submit.opcode is available.

Signed-off-by: Liu Yong <pkfxxxing@gmail.com>
---
 fs/io_uring.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index be3d595a607f..c1aaee061dae 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2559,6 +2559,7 @@ static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
 		goto err;
 	}
 
+	memcpy(&req->submit, s, sizeof(*s));
 	ret = io_req_set_file(ctx, s, state, req);
 	if (unlikely(ret)) {
 err_req:
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe
  2020-08-13  6:56 [PATCH] fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe Liu Yong
@ 2020-08-13 14:56 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-08-13 14:56 UTC (permalink / raw)
  To: Liu Yong; +Cc: linux-block, linux-kernel, linux-fsdevel

On 8/13/20 12:56 AM, Liu Yong wrote:
> the commit <a4d61e66ee4a> ("<io_uring: prevent re-read of sqe->opcode>") 
> caused another vulnerability. After io_get_req(), the sqe_submit struct 
> in req is not initialized, but the following code defaults that 
> req->submit.opcode is available.

Thanks, I'll add this for 5.4-stable, it doesn't affect any kernels newer
than that.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-13 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13  6:56 [PATCH] fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe Liu Yong
2020-08-13 14:56 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).