Thread (9 messages) 9 messages, 4 authors, 2019-07-15

Re: [PATCH] mm/gup: Use put_user_page*() instead of put_page*()

From: Jens Axboe <axboe@kernel.dk>
Date: 2019-07-15 02:34:10
Also in: bpf, kvm, linux-fsdevel, linux-media, linux-mm, lkml, netdev

On 7/14/19 1:08 PM, Bharath Vedartham wrote:
quoted hunk ↗ jump to hunk
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 4ef62a4..b4a4549 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2694,10 +2694,9 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, void __user *arg,
  			 * if we did partial map, or found file backed vmas,
  			 * release any pages we did get
  			 */
-			if (pret > 0) {
-				for (j = 0; j < pret; j++)
-					put_page(pages[j]);
-			}
+			if (pret > 0)
+				put_user_pages(pages, pret);
+
  			if (ctx->account_mem)
  				io_unaccount_mem(ctx->user, nr_pages);
  			kvfree(imu->bvec);
You handled just the failure case of the buffer registration, but not
the actual free in io_sqe_buffer_unregister().

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help