# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1188313718 -3600
# Node ID 7f53312a32973cdb6664e6f1d55bf3c4f68f5883
# Parent 505021d029eb486449ba5c61403237b49cdfd90a
ioemu: error checkin when setting up the Cirrus Logic video device.
set_mm_mapping() may fail because of xc_domain_populate_physmap(). In
this case, we should not blindly go on; the xc_map_foreign_batch()
that follows will cause a page fault and, at best, get mapped in a
zeroed page from the dom0 (which is not what we want). While I'm in
here, fix a memory leak on an error path.
Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx>
---
tools/ioemu/hw/cirrus_vga.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)
diff -r 505021d029eb -r 7f53312a3297 tools/ioemu/hw/cirrus_vga.c
--- a/tools/ioemu/hw/cirrus_vga.c Tue Aug 28 16:06:32 2007 +0100
+++ b/tools/ioemu/hw/cirrus_vga.c Tue Aug 28 16:08:38 2007 +0100
@@ -2559,7 +2559,11 @@ static void *set_vram_mapping(unsigned l
for (i = 0; i < nr_extents; i++)
extent_start[i] = (begin + i * TARGET_PAGE_SIZE) >> TARGET_PAGE_BITS;
- set_mm_mapping(xc_handle, domid, nr_extents, 0, extent_start);
+ if (set_mm_mapping(xc_handle, domid, nr_extents, 0, extent_start) < 0) {
+ fprintf(logfile, "Failed set_mm_mapping\n");
+ free(extent_start);
+ return NULL;
+ }
vram_pointer = xc_map_foreign_batch(xc_handle, domid,
PROT_READ|PROT_WRITE,
@@ -2567,6 +2571,7 @@ static void *set_vram_mapping(unsigned l
if (vram_pointer == NULL) {
fprintf(logfile, "xc_map_foreign_batch vgaram returned error %d\n",
errno);
+ free(extent_start);
return NULL;
}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|