Skip to content

Commit 76b28d3

Browse files
committed
Merge: mm/page_table_check: fix crash on ZONE_DEVICE
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4767 Depends: !4749 JIRA: https://issues.redhat.com/browse/RHEL-48052 CVE: CVE-2024-40948 Signed-off-by: Chris von Recklinghausen <crecklin@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: Rafael Aquini <raquini@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 9c9c019 + 02d1fa9 commit 76b28d3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mm/page_table_check.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ static void page_table_check_clear(struct mm_struct *mm, unsigned long addr,
7272
page = pfn_to_page(pfn);
7373
page_ext = page_ext_get(page);
7474

75+
if (!page_ext)
76+
return;
77+
7578
BUG_ON(PageSlab(page));
7679
anon = PageAnon(page);
7780

@@ -110,6 +113,9 @@ static void page_table_check_set(struct mm_struct *mm, unsigned long addr,
110113
page = pfn_to_page(pfn);
111114
page_ext = page_ext_get(page);
112115

116+
if (!page_ext)
117+
return;
118+
113119
BUG_ON(PageSlab(page));
114120
anon = PageAnon(page);
115121

@@ -140,7 +146,10 @@ void __page_table_check_zero(struct page *page, unsigned int order)
140146
BUG_ON(PageSlab(page));
141147

142148
page_ext = page_ext_get(page);
143-
BUG_ON(!page_ext);
149+
150+
if (!page_ext)
151+
return;
152+
144153
for (i = 0; i < (1ul << order); i++) {
145154
struct page_table_check *ptc = get_page_table_check(page_ext);
146155

0 commit comments

Comments
 (0)