From: Chris Lalancette <clalance@redhat.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH]: QEMU: Additional error checking in Cirrus setup
Date: Fri, 24 Aug 2007 14:21:06 -0400 [thread overview]
Message-ID: <46CF2192.80109@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 612 bytes --]
All,
Attached is a patch to do some additional error checking in QEMU when
setting up the Cirrus Logic video device. In particular, it may be the case
that that set_mm_mapping() fails 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.
The patch is against 3.1.0, but should apply fairly easily to xen-unstable.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
[-- Attachment #2: xen-3.1.0-qemu-error-check.patch --]
[-- Type: text/x-patch, Size: 1091 bytes --]
diff -urp xen-3.1.0-src.orig/tools/ioemu/hw/cirrus_vga.c xen-3.1.0-src/tools/ioemu/hw/cirrus_vga.c
--- xen-3.1.0-src.orig/tools/ioemu/hw/cirrus_vga.c 2007-05-18 10:45:21.000000000 -0400
+++ xen-3.1.0-src/tools/ioemu/hw/cirrus_vga.c 2007-08-24 09:58:43.000000000 -0400
@@ -2554,7 +2554,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,
@@ -2562,6 +2566,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;
}
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
reply other threads:[~2007-08-24 18:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46CF2192.80109@redhat.com \
--to=clalance@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.