diff --git a/io_uring/memmap.c b/io_uring/memmap.c index a0f32a255fd1..de5b584b7fab 100644 --- a/io_uring/memmap.c +++ b/io_uring/memmap.c @@ -72,6 +72,8 @@ void *io_pages_map(struct page ***out_pages, unsigned short *npages, ret = io_mem_alloc_compound(pages, nr_pages, size, gfp); if (!IS_ERR(ret)) goto done; + if (nr_pages == 1) + goto fail; ret = io_mem_alloc_single(pages, nr_pages, size, gfp); if (!IS_ERR(ret)) { @@ -80,7 +82,7 @@ done: *npages = nr_pages; return ret; } - +fail: kvfree(pages); *out_pages = NULL; *npages = 0;