|
|
5f5628 |
From 95224f0f92bc516983038a6326fba041cdef6e75 Mon Sep 17 00:00:00 2001
|
|
|
5f5628 |
From: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
5f5628 |
Date: Mon, 29 Mar 2021 14:22:56 +0200
|
|
|
5f5628 |
Subject: [PATCH xserver 06/27] xwayland/eglstream: Check buffer creation
|
|
|
5f5628 |
MIME-Version: 1.0
|
|
|
5f5628 |
Content-Type: text/plain; charset=UTF-8
|
|
|
5f5628 |
Content-Transfer-Encoding: 8bit
|
|
|
5f5628 |
|
|
|
5f5628 |
EGLStream wl_eglstream_display_create_stream() may fail, yet Xwayland
|
|
|
5f5628 |
would try to attach the buffer which may cause a fatal Wayland protocol
|
|
|
5f5628 |
error raised by the compositor.
|
|
|
5f5628 |
|
|
|
5f5628 |
Check if the buffer creation worked, and fail gracefully otherwise (like
|
|
|
5f5628 |
wayland-eglsurface does).
|
|
|
5f5628 |
|
|
|
5f5628 |
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
|
|
|
5f5628 |
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
|
|
|
5f5628 |
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
|
|
|
5f5628 |
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1156
|
|
|
5f5628 |
(cherry picked from commit 4f0889e98306d30a37aba0fadb1fd3790c13205a)
|
|
|
5f5628 |
---
|
|
|
5f5628 |
hw/xwayland/xwayland-glamor-eglstream.c | 8 +++++++-
|
|
|
5f5628 |
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
5f5628 |
|
|
|
5f5628 |
diff --git a/hw/xwayland/xwayland-glamor-eglstream.c b/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
5f5628 |
index 17295f3bd..c6e17bf8b 100644
|
|
|
5f5628 |
--- a/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
5f5628 |
+++ b/hw/xwayland/xwayland-glamor-eglstream.c
|
|
|
5f5628 |
@@ -548,6 +548,10 @@ xwl_eglstream_create_pending_stream(struct xwl_screen *xwl_screen,
|
|
|
5f5628 |
stream_fd,
|
|
|
5f5628 |
WL_EGLSTREAM_HANDLE_TYPE_FD,
|
|
|
5f5628 |
&stream_attribs);
|
|
|
5f5628 |
+ if (!xwl_pixmap->buffer) {
|
|
|
5f5628 |
+ ErrorF("eglstream: Failed to create buffer\n");
|
|
|
5f5628 |
+ goto fail;
|
|
|
5f5628 |
+ }
|
|
|
5f5628 |
|
|
|
5f5628 |
wl_buffer_add_listener(xwl_pixmap->buffer,
|
|
|
5f5628 |
&xwl_eglstream_buffer_release_listener,
|
|
|
5f5628 |
@@ -562,7 +566,9 @@ xwl_eglstream_create_pending_stream(struct xwl_screen *xwl_screen,
|
|
|
5f5628 |
|
|
|
5f5628 |
xwl_eglstream_queue_pending_stream(xwl_screen, window, pixmap);
|
|
|
5f5628 |
|
|
|
5f5628 |
- close(stream_fd);
|
|
|
5f5628 |
+fail:
|
|
|
5f5628 |
+ if (stream_fd >= 0)
|
|
|
5f5628 |
+ close(stream_fd);
|
|
|
5f5628 |
}
|
|
|
5f5628 |
|
|
|
5f5628 |
static Bool
|
|
|
5f5628 |
--
|
|
|
5f5628 |
2.31.1
|
|
|
5f5628 |
|