[PATCH] compositor-drm: Don't try and scan out a SHM buffer directly

Rob Bradford rob at robster.org.uk
Fri Sep 14 15:08:55 PDT 2012

From: Rob Bradford <rob at linux.intel.com>

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 at linux.intel.com>
 src/compositor-drm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 0faf45c..10f16bd 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -289,6 +289,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);

More information about the wayland-devel mailing list