diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-30 03:03:58 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-08-30 08:57:25 +0100 |
commit | 6d99249c580cfb062a05ce1da446410741eb1223 (patch) | |
tree | ffcae490ac1858700a8c06ba72fac98d0fa58658 | |
parent | 314cfd7353c8c1acd961fdfc8eadbc0d55fa0f01 (diff) |
sna: Protect against unattached pixmaps when peeking inside for a GPU bo
Prevent a NULL dereference for the small system pixmaps. Introduced with
commit f22d7f68b8b1bd5caf5ae831fca63eb1e6957520
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date: Wed Aug 28 14:24:33 2013 +0100
sna/gen6+: Improve ring stickyness for BLT composite ops
Reported-by: Sami Farin <hvtaifwkbgefbaei@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=68728
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/sna/sna.h b/src/sna/sna.h index 5b26ebfd..298883c8 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -176,6 +176,7 @@ static inline PixmapPtr get_window_pixmap(WindowPtr window) static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable) { + assert(drawable); if (drawable->type == DRAWABLE_PIXMAP) return (PixmapPtr)drawable; else @@ -619,7 +620,8 @@ static inline struct kgem_bo *__sna_pixmap_get_bo(PixmapPtr pixmap) static inline struct kgem_bo *__sna_drawable_peek_bo(DrawablePtr d) { - return sna_pixmap(get_drawable_pixmap(d))->gpu_bo; + struct sna_pixmap *priv = sna_pixmap(get_drawable_pixmap(d)); + return priv ? priv->gpu_bo : NULL; } static inline struct kgem_bo *sna_pixmap_pin(PixmapPtr pixmap, unsigned flags) |