- fix ioemu segv with old firmware
Without notifying ioemu of address, ioemu will segv.
- fix qemu-dm segv with malicous firmware
If notifying ioemu more than once, ioemu will segv.
Usually such cases don't happen, but malicious guest can
do it intentionally.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
fprintf(logfile,"mapping vram to %lx - %lx\n", begin, end);
+ if (!s->vram_mfns)
+ return;
+
xatp.domid = domid;
xatp.space = XENMAPSPACE_mfn;
if (copy)
memcpy(vram, xen_vga_state->vram_ptr, VGA_RAM_SIZE);
- qemu_free(xen_vga_state->vram_ptr);
+ if (xen_vga_state->vram_mfns) {
+ /* In case this function is called more than once */
+ free(xen_vga_state->vram_mfns);
+ munmap(xen_vga_state->vram_ptr, VGA_RAM_SIZE);
+ } else {
+ qemu_free(xen_vga_state->vram_ptr);
+ }
xen_vga_state->vram_ptr = vram;
xen_vga_state->vram_mfns = pfn_list;
#ifdef CONFIG_STUBDOM