Blame SOURCES/xorg-x11-server-composite-Fix-use-after-free-of-the-COW.patch

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