Thread (9 messages) 9 messages, 2 authors, 2021-09-30
STALE1738d REVIEWED: 7 (7M)
Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

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

From: Mike Rapoport <rppt@kernel.org>
Date: 2021-09-30 18:51:06
Also in: kvm, linux-alpha, linux-arm-kernel, linux-devicetree, linux-efi, linux-iommu, linux-mips, linux-mm, linux-riscv, linux-s390, linux-sh, linux-um, linux-usb, lkml, sparclinux, xen-devel
Subsystem: the rest, x86 architecture (32-bit and 64-bit), xen hypervisor x86 · Maintainers: Linus Torvalds, Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, Juergen Gross

From: Mike Rapoport <redacted>

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 <redacted>
Reviewed-by: Juergen Gross <jgross@suse.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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help