git: 3249449190c2 - main - vm_page_grab_valid(): clear *mp in case of pager denying page allocation

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sat, 17 Dec 2022 17:09:22 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=3249449190c2c71ecfc4fa5f518f94ff552df440

commit 3249449190c2c71ecfc4fa5f518f94ff552df440
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-12-17 00:12:14 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-12-17 17:01:43 +0000

    vm_page_grab_valid(): clear *mp in case of pager denying page allocation
    
    Same as it is done in other error return cases.  Callers depend on error
    case returning NULL, e.g. vm_imgact_hold_page().
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D37719
---
 sys/vm/vm_page.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c
index 797207205f42..90413f235ec0 100644
--- a/sys/vm/vm_page.c
+++ b/sys/vm/vm_page.c
@@ -4713,8 +4713,10 @@ retrylookup:
 		*mp = NULL;
 		return (VM_PAGER_FAIL);
 	} else if ((m = vm_page_alloc(object, pindex, pflags)) == NULL) {
-		if (!vm_pager_can_alloc_page(object, pindex))
+		if (!vm_pager_can_alloc_page(object, pindex)) {
+			*mp = NULL;
 			return (VM_PAGER_AGAIN);
+		}
 		goto retrylookup;
 	}