mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 17:40:11 +01:00
egl/drm: ensure the backing gbm is set before using it
Currently, if we error out before gbm_dri is set (say due to a different name of the backing GBM implementation, or otherwise) the tear down will trigger a NULL ptr deref and crash out. Move the gbm_dri initialization as early as possible. v2: Drop check in dri2_teardowm_drm (Eric) Reported-by: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: mesa-stable@lists.freedesktop.org Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
This commit is contained in:
parent
4bf7e7b170
commit
72b97ad9b2
1 changed files with 1 additions and 1 deletions
|
|
@ -715,6 +715,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dri2_dpy->gbm_dri = gbm_dri_device(gbm);
|
||||||
|
|
||||||
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) {
|
if (strcmp(gbm_device_get_backend_name(gbm), "drm") != 0) {
|
||||||
err = "DRI2: gbm device using incorrect/incompatible backend";
|
err = "DRI2: gbm device using incorrect/incompatible backend";
|
||||||
|
|
@ -729,7 +730,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
|
||||||
|
|
||||||
disp->Device = dev;
|
disp->Device = dev;
|
||||||
|
|
||||||
dri2_dpy->gbm_dri = gbm_dri_device(gbm);
|
|
||||||
dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->driver_name);
|
dri2_dpy->driver_name = strdup(dri2_dpy->gbm_dri->driver_name);
|
||||||
|
|
||||||
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
|
dri2_dpy->dri_screen = dri2_dpy->gbm_dri->screen;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue