egl/drm: ensure the backing gbm is set before using it
authorEmil Velikov <emil.velikov@collabora.com>
Fri, 5 Jul 2019 10:14:30 +0000 (11:14 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 31 Jul 2019 13:18:12 +0000 (14:18 +0100)
commit72b97ad9b2bc84742d289219f9129a68040baf0e
tree6308161ca8e10abd021d3e42de2a12958687c792
parent4bf7e7b17092487b6b6c4aff5e920dbe1fd4470e
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>
src/egl/drivers/dri2/platform_drm.c