summaryrefslogtreecommitdiff
path: root/src/sna
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-09-25 13:54:43 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-09-25 13:54:43 +0100
commitd7eb40efa79dd9ea720606b94a20179c7dd18e03 (patch)
treecc91561410716d450c2faf34d1637ca8c76db7e4 /src/sna
parenta934b2455a7b67d124903ab086a323169f0b4d69 (diff)
sna: Check that the bo exists before attempting to undo it
Fixes a NULL dereference from sna_blt_composite(). Bugzilla: https://bugs.launchpad.net/ubuntu/+source/xserver-xorg-video-intel/+bug/1228677 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r--src/sna/kgem.c1
-rw-r--r--src/sna/sna_blt.c2
-rw-r--r--src/sna/sna_io.c1
3 files changed, 3 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 336bd7d6..78116153 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -1932,6 +1932,7 @@ void kgem_bo_undo(struct kgem *kgem, struct kgem_bo *bo)
if (kgem->nexec != 1 || bo->exec == NULL)
return;
+ assert(bo);
DBG(("%s: only handle in batch, discarding last operations for handle=%d\n",
__FUNCTION__, bo->handle));
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 1f173daf..fdcc4198 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -2250,7 +2250,7 @@ fill:
tmp->dst.bo = sna_drawable_use_bo(dst->pDrawable, hint,
&dst_box, &tmp->damage);
- if (hint & REPLACES)
+ if (tmp->dst.bo && hint & REPLACES)
kgem_bo_undo(&sna->kgem, tmp->dst.bo);
ret = false;
diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c
index 2a318206..746b1226 100644
--- a/src/sna/sna_io.c
+++ b/src/sna/sna_io.c
@@ -1438,6 +1438,7 @@ bool sna_replace(struct sna *sna,
struct kgem *kgem = &sna->kgem;
void *dst;
+ assert(bo);
DBG(("%s(handle=%d, %dx%d, bpp=%d, tiling=%d) busy?=%d\n",
__FUNCTION__, bo->handle,
pixmap->drawable.width,