[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] efi/boot: Avoid memory corruption when freeing ebmalloc area



Don't free the final page containing a partial allocation.

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>

NB: This was from code inspection.  It is not whatever is causing the bisector
to finger this commit.
---
 xen/common/efi/boot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
index b6cbdad..f89163c 100644
--- a/xen/common/efi/boot.c
+++ b/xen/common/efi/boot.c
@@ -148,7 +148,7 @@ static void __init __maybe_unused 
free_ebmalloc_unused_mem(void)
 {
     unsigned long start, end;
 
-    start = (unsigned long)ebmalloc_mem + PAGE_ALIGN(ebmalloc_allocated);
+    start = (unsigned long)ebmalloc_mem + ROUNDUP(ebmalloc_allocated, 
PAGE_SIZE);
     end = (unsigned long)ebmalloc_mem + sizeof(ebmalloc_mem);
 
     destroy_xen_mappings(start, end);
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.