Skip to content

Commit 8ec1415

Browse files
committed
vfio: fix use-after-free in display
Calling ramfb_display_update() might replace the DisplaySurface with the boot display, which in turn will free the currently active DisplaySurface. So clear our DisplaySurface pinter (dpy->region.surface pointer) to (a) avoid use-after-free and (b) force replacing the boot display with the real display when switching back. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Alex Williamson <[email protected]> Acked-by: Alex Williamson <[email protected]> Message-id: [email protected]
1 parent 8746309 commit 8ec1415

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

hw/vfio/display.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ static void vfio_display_region_update(void *opaque)
405405
if (!plane.drm_format || !plane.size) {
406406
if (dpy->ramfb) {
407407
ramfb_display_update(dpy->con, dpy->ramfb);
408+
dpy->region.surface = NULL;
408409
}
409410
return;
410411
}

0 commit comments

Comments
 (0)