diff mbox series

mm/page_alloc: Return nr_populated when the array is full

Message ID 162490051493.1165.8122675403341013520.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series mm/page_alloc: Return nr_populated when the array is full | expand

Commit Message

Chuck Lever June 28, 2021, 5:15 p.m. UTC
The SUNRPC consumer of __alloc_bulk_pages() legitimately calls it
with a full array sometimes. In that case, the correct return code,
according to the API contract, is to return the number of requested
pages.

Fixes: b3b64ebd3822 ("mm/page_alloc: do bulk array bounds check after checking populated elements")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ef2265f86b91..79f88c4ae372 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5058,7 +5058,7 @@  unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
 
 	/* Already populated array? */
 	if (unlikely(page_array && nr_pages - nr_populated == 0))
-		return 0;
+		return nr_pages;
 
 	/* Use the single page allocator for one page. */
 	if (nr_pages - nr_populated == 1)