compositor-drm: Don't try and scan out a SHM buffer directly
authorRob Bradford <rob@linux.intel.com>
Fri, 14 Sep 2012 22:02:47 +0000 (23:02 +0100)
committerOssama Othman <ossama.othman@intel.com>
Fri, 19 Apr 2013 22:59:49 +0000 (15:59 -0700)
gbm_bo_import will fail to produce a valid bo since the buffer is an SHM
buffer. This cause a crash when the NULL bo returned by gbm_bo_import is
dereferenced later.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
src/compositor-drm.c

index f055118..127a6e5 100644 (file)
@@ -316,6 +316,9 @@ drm_output_prepare_scanout_surface(struct weston_output *_output,
            es->buffer == NULL)
                return NULL;
 
+       if (wl_buffer_is_shm(es->buffer))
+               return NULL;
+
        bo = gbm_bo_import(c->gbm, GBM_BO_IMPORT_WL_BUFFER,
                           es->buffer, GBM_BO_USE_SCANOUT);