]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
authorMike Rapoport <rppt@linux.ibm.com>
Fri, 5 Nov 2021 20:43:10 +0000 (13:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Nov 2021 20:30:41 +0000 (13:30 -0700)
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.

Link: https://lkml.kernel.org/r/20210930185031.18648-3-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/xen/p2m.c

index 5e6e236977c75f5f2aa3f7677419a17fd37ceba2..141bb9dbd2fbe06fc776aa97648ab86d675e8c5c 100644 (file)
@@ -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;
        }