qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfio: fix use-after-free in display
@ 2020-07-13 12:45 Gerd Hoffmann
  2020-07-13 12:51 ` Philippe Mathieu-Daudé
  2020-07-13 20:53 ` Alex Williamson
  0 siblings, 2 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-07-13 12:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Williamson, Gerd Hoffmann

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 <kraxel@redhat.com>
---
 hw/vfio/display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/vfio/display.c b/hw/vfio/display.c
index a57a22674d62..342054193b3c 100644
--- a/hw/vfio/display.c
+++ b/hw/vfio/display.c
@@ -405,6 +405,7 @@ static void vfio_display_region_update(void *opaque)
     if (!plane.drm_format || !plane.size) {
         if (dpy->ramfb) {
             ramfb_display_update(dpy->con, dpy->ramfb);
+            dpy->region.surface = NULL;
         }
         return;
     }
-- 
2.18.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-15 10:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-13 12:45 [PATCH] vfio: fix use-after-free in display Gerd Hoffmann
2020-07-13 12:51 ` Philippe Mathieu-Daudé
2020-07-13 14:00   ` Gerd Hoffmann
2020-07-13 14:09     ` Philippe Mathieu-Daudé
2020-07-13 20:53 ` Alex Williamson
2020-07-15 10:40   ` Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).