Skip to contentSkip to conversation

sparc: Fix handling of page table constructor failure

PATCH In review Matthew Wilcox (Oracle) 2 participants 3 messages Sep 27, 2020 – Oct 8, 2020 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc: Fix handling of page table constructor failure

The page has just been allocated, so its refcount is 1. free_unref_page() is for use on pages which have a zero refcount. Use __free_page() like the other implementations of pte_alloc_one().

Fixes 1ae9ae5f7df7 ("sparc: handle pgtable_page_ctor() fail")
---
 arch/sparc/mm/init_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/mm/init_64.c +1 -1
index fad6d3129904..4288f08a5736 100644
@@ -2898,7 +2898,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
 	if (!page)
 		return NULL;
 	if (!pgtable_pte_page_ctor(page)) {
-		free_unref_page(page);
+		__free_page(page);
 		return NULL;
 	}
 	return (pte_t *) page_address(page);
Signature · 1 line
2.28.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Matthew Wilcox (Oracle)

The page has just been allocated, so its refcount is 1. free_unref_page() is for use on pages which have a zero refcount. Use __free_page() like the other implementations of pte_alloc_one().

Fixes 1ae9ae5f7df7 ("sparc: handle pgtable_page_ctor() fail")
Quoted 20 lines
---
 arch/sparc/mm/init_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/mm/init_64.c +1 -1
index fad6d3129904..4288f08a5736 100644
@@ -2898,7 +2898,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
 	if (!page)
 		return NULL;
 	if (!pgtable_pte_page_ctor(page)) {
-		free_unref_page(page);
+		__free_page(page);
 		return NULL;
 	}
 	return (pte_t *) page_address(page);
Signature · 1 line
2.28.0
Signature · 2 lines
Sincerely yours,
Mike.
#2 lore raw
In reply to Matthew Wilcox (Oracle)

ping

Quoted 26 lines · Matthew Wilcox (Oracle)

The page has just been allocated, so its refcount is 1. free_unref_page() is for use on pages which have a zero refcount. Use __free_page() like the other implementations of pte_alloc_one().

Fixes 1ae9ae5f7df7 ("sparc: handle pgtable_page_ctor() fail")
---
 arch/sparc/mm/init_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/mm/init_64.c +1 -1
index fad6d3129904..4288f08a5736 100644
@@ -2898,7 +2898,7 @@ pgtable_t pte_alloc_one(struct mm_struct *mm)
 	if (!page)
 		return NULL;
 	if (!pgtable_pte_page_ctor(page)) {
-		free_unref_page(page);
+		__free_page(page);
 		return NULL;
 	}
 	return (pte_t *) page_address(page);
Signature · 1 line
2.28.0