linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][for-linus] io_uring: Fix leaked shadow_req
@ 2019-10-27 19:10 Pavel Begunkov
  2019-10-28  3:29 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2019-10-27 19:10 UTC (permalink / raw)
  To: Jens Axboe, linux-block, linux-kernel

io_queue_link_head() owns shadow_req after taking it as an argument.
By not freeing it in case of an error, it can leak the request along
with taken ctx->refs.

Signed-off-by: Pavel Begunkov <asml.silence@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 fa83ea2c16ee..5a48687c4efa 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2413,6 +2413,7 @@ static int io_queue_link_head(struct io_ring_ctx *ctx, struct io_kiocb *req,
 	if (ret) {
 		if (ret != -EIOCBQUEUED) {
 			io_free_req(req);
+			__io_free_req(shadow);
 			io_cqring_add_event(ctx, s->sqe->user_data, ret);
 			return 0;
 		}
-- 
2.23.0


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

* Re: [PATCH][for-linus] io_uring: Fix leaked shadow_req
  2019-10-27 19:10 [PATCH][for-linus] io_uring: Fix leaked shadow_req Pavel Begunkov
@ 2019-10-28  3:29 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2019-10-28  3:29 UTC (permalink / raw)
  To: Pavel Begunkov, linux-block, linux-kernel

On 10/27/19 1:10 PM, Pavel Begunkov wrote:
> io_queue_link_head() owns shadow_req after taking it as an argument.
> By not freeing it in case of an error, it can leak the request along
> with taken ctx->refs.

Thakns, applied.

-- 
Jens Axboe


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

end of thread, other threads:[~2019-10-28  3:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-27 19:10 [PATCH][for-linus] io_uring: Fix leaked shadow_req Pavel Begunkov
2019-10-28  3:29 ` 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).