lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200605093203.40087-1-efremov@linux.com>
Date:   Fri,  5 Jun 2020 12:32:03 +0300
From:   Denis Efremov <efremov@...ux.com>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     Denis Efremov <efremov@...ux.com>,
        Mark Rutland <mark.rutland@....com>, io-uring@...r.kernel.org,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: [PATCH] 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")
Cc: stable@...r.kernel.org
Signed-off-by: Denis Efremov <efremov@...ux.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ