From: Emil Velikov <[email protected]>

Entry-point was introduced with v7 and may be NULL.
Check and bail out accordingly.

Fixes: a43d286ef7f ("gbm: Add import from fd")
Cc: Kristian Høgsberg <[email protected]>
Signed-off-by: Emil Velikov <[email protected]>

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 531361a04d9..35298751237 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -950,6 +950,12 @@ gbm_dri_bo_import(struct gbm_device *gbm,
       int stride = fd_data->stride, offset = 0;
       int fourcc;
 
+      if (dri->image->base.version < 7 ||
+          dri->image->createImageFromFds == NULL) {
+         errno = ENOSYS;
+         return NULL;
+      }
+
       /* GBM's GBM_FORMAT_* tokens are a strict superset of the DRI FourCC
        * tokens accepted by createImageFromFds, except for not supporting
        * the sARGB format. */
-- 
2.14.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to