mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
xwayland: fix segment fault in xwl_glamor_gbm_init_main_dev
Function `xwl_glamor_gbm_init_main_dev` does not check whether
`xwl_screen->default_feedback.main_dev` a.k.a. `main_dev` is a
valid pointer. This result in some special situation where main
linux-dmabuf device is not accessible, such as KWin nested desktop,
raising segment fault.
This commit add a null pointer check to prevent crashing.
Signed-off-by: Chenx Dust <chenx_dust@outlook.com>
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1683
Fixes: d7f1909e - xwayland/glamor/gbm: make wl_drm optional
See-also: https://bugzilla.redhat.com/2284141
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1565>
This commit is contained in:
@@ -1514,6 +1514,11 @@ xwl_glamor_gbm_init_main_dev(struct xwl_screen *xwl_screen)
|
||||
}
|
||||
|
||||
main_dev = xwl_screen->default_feedback.main_dev;
|
||||
if (!main_dev) {
|
||||
ErrorF("No main linux-dmabuf device advertised by compositor\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!(main_dev->available_nodes & (1 << DRM_NODE_RENDER))) {
|
||||
ErrorF("Main linux-dmabuf device has no render node\n");
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user