Skip to contentSkip to conversation

io_uring: use kvfree() in io_sqe_buffer_register()

PATCH Applied Denis Efremov 2 participants 2 messages Jun 5, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: use kvfree() in io_sqe_buffer_register()

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")

---
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(-)
fs/io_uring.c +2 -2
index 9d4bd0d3a080..defb8a3538fc 100644
@@ -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,
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw
Quoted 2 lines · Denis Efremov

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

Applied, thanks.

Signature · 1 line
Jens Axboe