]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
fs/io_uring.c: Fix uninitialized variable is referenced in io_submit_sqe
authorLiu Yong <pkfxxxing@gmail.com>
Thu, 13 Aug 2020 06:56:44 +0000 (23:56 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:15:53 +0000 (08:15 +0200)
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/io_uring.c

index be3d595a607f4102a6f12defa741896c2bd92f8b..c1aaee061dae5ec165aae240d50b7577313a2a5f 100644 (file)
@@ -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: