Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 2021 20:58:22 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9658d9c71ae5 - main - amd64 pmap: fix NULL deref in pmap_mincore().
Message-ID:  <202101112058.10BKwM4A041810@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9658d9c71ae5eebb42cb86372ca75bb7ec0a0638

commit 9658d9c71ae5eebb42cb86372ca75bb7ec0a0638
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-05 15:36:37 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-01-11 20:57:52 +0000

    amd64 pmap: fix NULL deref in pmap_mincore().
    
    pmap_pdpe() might return NULL, check for it.
    
    Reviewed by:    markj
    Reported and tested by: pho
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D27956
---
 sys/amd64/amd64/pmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 2ec303d687a7..f4bfceb6aaaa 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -9490,6 +9490,8 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap)
 	pa = 0;
 	val = 0;
 	pdpe = pmap_pdpe(pmap, addr);
+	if (pdpe == NULL)
+		goto out;
 	if ((*pdpe & PG_V) != 0) {
 		if ((*pdpe & PG_PS) != 0) {
 			pte = *pdpe;
@@ -9525,6 +9527,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap)
 	    (pte & (PG_MANAGED | PG_V)) == (PG_MANAGED | PG_V)) {
 		*pap = pa;
 	}
+out:
 	PMAP_UNLOCK(pmap);
 	return (val);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101112058.10BKwM4A041810>