[PATCH v2] present: fix freed pointer access

Olivier Fourdan ofourdan at redhat.com
Wed Sep 5 11:13:25 UTC 2018


Hi,

On Tue, Sep 4, 2018 at 6:28 PM Lionel Landwerlin
<lionel.g.landwerlin at intel.com> wrote:
>
> Oh well...
> I'm sure you'll be able to fix it faster than me :)
>
> -
> Lionel
>
> On 04/09/2018 16:27, Roman Gilg wrote:
>
> Ok, I just got a failing assert in xwl_present_flips_stop with the patch when opening a context menu in Steam. Seems the xwl_present_flips_stop call is coming in too late now after the presenting window has already been changed.
>
[...]

If I read bug 107314 correctly, the crash occurs after the window has
been destroyed, so what about that other patch:

https://patchwork.freedesktop.org/patch/247271/

** plus ** this patch below (just copied for testing purpose), does it
fix th your crash?

>From 676597fcd6ee907f4d3f165dd0b5de746f7c8131 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan at redhat.com>
Date: Wed, 5 Sep 2018 13:08:03 +0200
Subject: [PATCH xserver] xwayland: ignore sync callback if window is destroyed

If the window is destroyed, there is no need to send the vblank notify
event.

This should avoid a crash in present_vblank_notify()

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107314
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 hw/xwayland/xwayland-present.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index 316e04443..b1751c846 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -276,6 +276,10 @@ xwl_present_sync_callback(void *data,

     event->pending = FALSE;

+    /* Is the window destroyed already ? */
+    if (!xwl_present_window)
+        return;
+
     if (event->abort) {
         /* Event might have been aborted */
         if (event->buffer_released)
-- 
2.17.1


More information about the xorg-devel mailing list