All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pavel Begunkov (Silence)" <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Pavel Begunkov <asml.silence@gmail.com>
Subject: [PATCH 1/3] io_uring: Fix corrupted user_data
Date: Fri, 25 Oct 2019 12:31:29 +0300	[thread overview]
Message-ID: <53e2b76c28b82c98973efca2126d71ecf62e3fdb.1571991701.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1571991701.git.asml.silence@gmail.com>

From: Pavel Begunkov <asml.silence@gmail.com>

There is a bug, where failed linked requests are returned not with
specified @user_data, but with garbage from a kernel stack.

The reason is that io_fail_links() uses req->user_data, which is
uninitialised when called from io_queue_sqe() on fail path.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 1b46c72f8975..0e141d905a5b 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2448,6 +2448,8 @@ static void io_submit_sqe(struct io_ring_ctx *ctx, struct sqe_submit *s,
 		return;
 	}
 
+	req->user_data = s->sqe->user_data;
+
 	/*
 	 * If we already have a head request, queue this one for async
 	 * submittal once the head completes. If we don't have a head but
-- 
2.23.0


  reply	other threads:[~2019-10-25  9:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  9:31 [PATCH 0/3][for-linus] Fix bunch of bugs in io_uring Pavel Begunkov (Silence)
2019-10-25  9:31 ` Pavel Begunkov (Silence) [this message]
2019-10-25  9:31 ` [PATCH 2/3] io_uring: Fix broken links with offloading Pavel Begunkov (Silence)
2019-10-25  9:36   ` Pavel Begunkov
2019-10-25 15:01     ` Jens Axboe
2019-10-25  9:31 ` [PATCH 3/3] io_uring: Fix race for sqes with userspace Pavel Begunkov (Silence)
2019-10-25 15:01 ` [PATCH 0/3][for-linus] Fix bunch of bugs in io_uring 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 \
    --in-reply-to=53e2b76c28b82c98973efca2126d71ecf62e3fdb.1571991701.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.