]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
io_uring: use kvfree() in io_sqe_buffer_register()
authorDenis Efremov <efremov@linux.com>
Fri, 5 Jun 2020 09:32:03 +0000 (12:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Jun 2020 14:42:50 +0000 (16:42 +0200)
commit a8c73c1a614f6da6c0b04c393f87447e28cb6de4 upstream.

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")
Signed-off-by: Denis Efremov <efremov@linux.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200605093203.40087-1-efremov@linux.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index 6883104323bdf4b808689c840218589280bf24ac..9a9ae6b4eeacf229a95c6d599f75fd81ff8a63fd 100644 (file)
@@ -7093,8 +7093,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,