Blame SOURCES/0001-composite-Fix-use-after-free-of-the-COW.patch

615064
From 947bd1b3f4a23565bf10879ec41ba06ebe1e1c76 Mon Sep 17 00:00:00 2001
615064
From: Olivier Fourdan <ofourdan@redhat.com>
615064
Date: Mon, 13 Mar 2023 11:08:47 +0100
615064
Subject: [PATCH xserver] composite: Fix use-after-free of the COW
615064
615064
ZDI-CAN-19866/CVE-2023-1393
615064
615064
If a client explicitly destroys the compositor overlay window (aka COW),
615064
we would leave a dangling pointer to that window in the CompScreen
615064
structure, which will trigger a use-after-free later.
615064
615064
Make sure to clear the CompScreen pointer to the COW when the latter gets
615064
destroyed explicitly by the client.
615064
615064
This vulnerability was discovered by:
615064
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative
615064
615064
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
615064
Reviewed-by: Adam Jackson <ajax@redhat.com>
615064
---
615064
 composite/compwindow.c | 5 +++++
615064
 1 file changed, 5 insertions(+)
615064
615064
diff --git a/composite/compwindow.c b/composite/compwindow.c
615064
index 4e2494b86..b30da589e 100644
615064
--- a/composite/compwindow.c
615064
+++ b/composite/compwindow.c
615064
@@ -620,6 +620,11 @@ compDestroyWindow(WindowPtr pWin)
615064
     ret = (*pScreen->DestroyWindow) (pWin);
615064
     cs->DestroyWindow = pScreen->DestroyWindow;
615064
     pScreen->DestroyWindow = compDestroyWindow;
615064
+
615064
+    /* Did we just destroy the overlay window? */
615064
+    if (pWin == cs->pOverlayWin)
615064
+        cs->pOverlayWin = NULL;
615064
+
615064
 /*    compCheckTree (pWin->drawable.pScreen); can't check -- tree isn't good*/
615064
     return ret;
615064
 }
615064
-- 
615064
2.40.0
615064