[PATCH] drm/i915: check fence to avoid null pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if drm_syncobj_fence_get return null, we will get a
null pointer. Fix this by adding the null pointer check
on fence.

Signed-off-by: Yongzhi Liu <lyz_cs@xxxxxxxxxx>
---
 drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index fd0e15d..3a82a62 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -3184,6 +3184,10 @@ eb_fences_add(struct i915_execbuffer *eb, struct i915_request *rq,
 		struct dma_fence *fence;
 
 		fence = drm_syncobj_fence_get(eb->gem_context->syncobj);
+		if (!fence) {
+			DRM_DEBUG("Syncobj has no fence\n");
+			return ERR_PTR(-EINVAL);
+		}
 		err = i915_request_await_dma_fence(rq, fence);
 		dma_fence_put(fence);
 		if (err)
-- 
2.7.4




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux