When pret is less than or equal to 0, put_user_pages can be processed correctly. Signed-off-by: Jackie Liu <liuyun01@xxxxxxxxxx> --- fs/io_uring.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 8a1de5a..be1e010 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2959,8 +2959,7 @@ 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) - put_user_pages(pages, pret); + put_user_pages(pages, pret); if (ctx->account_mem) io_unaccount_mem(ctx->user, nr_pages); kvfree(imu->bvec); -- 2.7.4