[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200416131340.873146158@linuxfoundation.org>
Date: Thu, 16 Apr 2020 15:23:26 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Pavel Begunkov <asml.silence@...il.com>,
Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 5.6 117/254] io_uring: fix ctx refcounting in io_submit_sqes()
From: Pavel Begunkov <asml.silence@...il.com>
commit 48bdd849e967f1c573d2b2bc24308e24a83f39c2 upstream.
If io_get_req() fails, it drops a ref. Then, awhile keeping @submitted
unmodified, io_submit_sqes() breaks the loop and puts @nr - @submitted
refs. For each submitted req a ref is dropped in io_put_req() and
friends. So, for @nr taken refs there will be
(@nr - @submitted + @submitted + 1) dropped.
Remove ctx refcounting from io_get_req(), that at the same time makes
it clearer.
Fixes: 2b85edfc0c90 ("io_uring: batch getting pcpu references")
Cc: stable@...r.kernel.org # v5.6
Signed-off-by: Pavel Begunkov <asml.silence@...il.com>
Signed-off-by: Jens Axboe <axboe@...nel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/io_uring.c | 1 -
1 file changed, 1 deletion(-)
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1242,7 +1242,6 @@ fallback:
req = io_get_fallback_req(ctx);
if (req)
goto got_it;
- percpu_ref_put(&ctx->refs);
return NULL;
}
Powered by blists - more mailing lists