Mesa (master): egl/dri2: Don't dlclose() the driver on dri2_load_driver_common failure

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 3 14:22:24 UTC 2019


Module: Mesa
Branch: master
Commit: 1b87f4058de84d7a0bb4ead0c4f4b024d4cce8fb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b87f4058de84d7a0bb4ead0c4f4b024d4cce8fb

Author: Adam Jackson <ajax at redhat.com>
Date:   Wed Oct  2 16:26:48 2019 -0400

egl/dri2: Don't dlclose() the driver on dri2_load_driver_common failure

... because it's wrong to do so. The error path out of
dri2_initialize_drm ends with dri2_display_destroy, which calls
functions in the vtable we're trying to set up, so if we dlclose the
driver then those function pointers will point off into space and things
crash.

Noticed this because after !1923 eglinfo would crash when setting up the
GBM platform. This was something of a cascade failure, because my kernel
is too old for DRM_IOCTL_I915_GETPARAM to work without DRM_AUTH, so i965
wouldn't load. platform_drm.c then got very confused when it tries to
load swrast as a dri2 driver.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/egl/drivers/dri2/egl_dri2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 82a0bed5c62..23d0e469427 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -633,10 +633,9 @@ dri2_load_driver_common(_EGLDisplay *disp,
    if (!extensions)
       return EGL_FALSE;
 
-   if (!dri2_bind_extensions(dri2_dpy, driver_extensions, extensions, false)) {
-      dlclose(dri2_dpy->driver);
+   if (!dri2_bind_extensions(dri2_dpy, driver_extensions, extensions, false))
       return EGL_FALSE;
-   }
+
    dri2_dpy->driver_extensions = extensions;
 
    dri2_bind_extensions(dri2_dpy, optional_driver_extensions, extensions, true);




More information about the mesa-commit mailing list