[PATCH 2/3] xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer

Mike Rapoport posted 3 patches 3 years, 2 months ago
There is a newer version of this series
[PATCH 2/3] xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
Posted by Mike Rapoport 3 years, 2 months ago
From: Mike Rapoport <rppt@linux.ibm.com>

free_p2m_page() wrongly passes a virtual pointer to memblock_free() that
treats it as a physical address.

Call memblock_free_ptr() instead that gets a virtual address to free the
memory.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/x86/xen/p2m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 5e6e236977c7..141bb9dbd2fb 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -197,7 +197,7 @@ static void * __ref alloc_p2m_page(void)
 static void __ref free_p2m_page(void *p)
 {
 	if (unlikely(!slab_is_available())) {
-		memblock_free((unsigned long)p, PAGE_SIZE);
+		memblock_free_ptr(p, PAGE_SIZE);
 		return;
 	}
 
-- 
2.28.0


Re: [PATCH 2/3] xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
Posted by Juergen Gross 3 years, 2 months ago
On 23.09.21 09:43, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> free_p2m_page() wrongly passes a virtual pointer to memblock_free() that
> treats it as a physical address.
> 
> Call memblock_free_ptr() instead that gets a virtual address to free the
> memory.
> 
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen