From 7670099e0b63b19e93d56a55f475e20bc1a1f2a3 Mon Sep 17 00:00:00 2001 From: markj Date: Wed, 23 Oct 2019 20:39:21 +0000 Subject: [PATCH] Modify release_page() to handle a missing fault page. r353890 introduced a case where we may call release_page() with fs.m == NULL, since the fault handler may now lock the vnode prior to allocating a page for a page-in. Reported by: jhb Reviewed by: kib MFC with: r353890 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22120 --- sys/vm/vm_fault.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 8e004ad390ab..b8d0924243cc 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -154,11 +154,13 @@ static inline void release_page(struct faultstate *fs) { - vm_page_xunbusy(fs->m); - vm_page_lock(fs->m); - vm_page_deactivate(fs->m); - vm_page_unlock(fs->m); - fs->m = NULL; + if (fs->m != NULL) { + vm_page_xunbusy(fs->m); + vm_page_lock(fs->m); + vm_page_deactivate(fs->m); + vm_page_unlock(fs->m); + fs->m = NULL; + } } static inline void