Re: [PATCH] mm/gup: Use put_user_page*() instead of put_page*()
From: Bharath Vedartham
Date: Mon Jul 15 2019 - 02:59:41 EST
On Sun, Jul 14, 2019 at 08:33:57PM -0600, Jens Axboe wrote:
> On 7/14/19 1:08 PM, Bharath Vedartham wrote:
> > 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
Yup got it! Thanks! I won't be sending a patch again as fs/io_uring.c
may have larger local changes for put_user_pages.
Thanks