summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Isorce <[email protected]>2017-03-10 17:16:05 +0000
committerMarek Olšák <[email protected]>2017-03-13 17:17:30 +0100
commitd09edb01468ca385b6a8ffe29ac434dc42a78d07 (patch)
tree92c96af03268e6d6bd5cc36f60136c59f0d0122f
parent192de3f051c70ff1404369f88ae2d55f1ffcf806 (diff)
winsys/radeon: check null in radeon_cs_create_fence
Fixes the following segmentation fault: radeon_drm_cs_add_buffer (bo=0x0) at radeon_drm_cs.c -> if (!bo->handle) (gdb) bt 0 radeon_drm_cs_add_buffer (bo=0x0) at radeon_drm_cs.c 1 0x00007fffe73575de in radeon_cs_create_fence radeon_drm_cs.c 2 0x00007fffe7358c48 in radeon_drm_cs_flush radeon_drm_cs.c Signed-off-by: Julien Isorce <[email protected]> Signed-off-by: Marek Olšák <[email protected]>
-rw-r--r--src/gallium/winsys/radeon/drm/radeon_drm_cs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index d431bfc11f4..1545fd82637 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -750,6 +750,9 @@ radeon_cs_create_fence(struct radeon_winsys_cs *rcs)
/* Create a fence, which is a dummy BO. */
fence = cs->ws->base.buffer_create(&cs->ws->base, 1, 1,
RADEON_DOMAIN_GTT, RADEON_FLAG_HANDLE);
+ if (!fence)
+ return NULL;
+
/* Add the fence as a dummy relocation. */
cs->ws->base.cs_add_buffer(rcs, fence,
RADEON_USAGE_READWRITE, RADEON_DOMAIN_GTT,