All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: use kvfree() in io_sqe_buffer_register()
@ 2020-06-05  9:32 Denis Efremov
  2020-06-05 12:47 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Efremov @ 2020-06-05  9:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Denis Efremov, Mark Rutland, io-uring, linux-kernel, stable

Use kvfree() to free the pages and vmas, since they are allocated by
kvmalloc_array() in a loop.

Fixes: d4ef647510b1 ("io_uring: avoid page allocation warnings")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Efremov <efremov@linux.com>
---
I checked the v1 d4ef647510b1 discussion and these lines are using
kvfree() https://lkml.org/lkml/2019/5/1/254. This was somehow missed
in v2.

 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 9d4bd0d3a080..defb8a3538fc 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7160,8 +7160,8 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg,
 
 		ret = 0;
 		if (!pages || nr_pages > got_pages) {
-			kfree(vmas);
-			kfree(pages);
+			kvfree(vmas);
+			kvfree(pages);
 			pages = kvmalloc_array(nr_pages, sizeof(struct page *),
 						GFP_KERNEL);
 			vmas = kvmalloc_array(nr_pages,
-- 
2.26.2


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

* Re: [PATCH] io_uring: use kvfree() in io_sqe_buffer_register()
  2020-06-05  9:32 [PATCH] io_uring: use kvfree() in io_sqe_buffer_register() Denis Efremov
@ 2020-06-05 12:47 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-06-05 12:47 UTC (permalink / raw)
  To: Denis Efremov; +Cc: Mark Rutland, io-uring, linux-kernel, stable

On 6/5/20 3:32 AM, Denis Efremov wrote:
> Use kvfree() to free the pages and vmas, since they are allocated by
> kvmalloc_array() in a loop.

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2020-06-05 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-05  9:32 [PATCH] io_uring: use kvfree() in io_sqe_buffer_register() Denis Efremov
2020-06-05 12:47 ` Jens Axboe

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.