summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_context.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-07-17 09:44:49 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-25 10:39:58 +0200
commitbe636387f81376ff26963987531c89a63faf8a33 (patch)
treee73886593a4739238109def962d01ca8f8bae38f /drivers/gpu/drm/i915/i915_gem_context.c
parentb259b3120607f642daabdaadc99430a306899ffe (diff)
downloadblackbird-op-linux-be636387f81376ff26963987531c89a63faf8a33.tar.gz
blackbird-op-linux-be636387f81376ff26963987531c89a63faf8a33.zip
drm/i915: dereferencing an error pointer
We need to check that "ctx" is a valid pointer before dereferencing it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_context.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_context.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 873119f2436e..da8b01fb1bf8 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -497,11 +497,13 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
ctx = create_hw_context(dev, file_priv);
mutex_unlock(&dev->struct_mutex);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
args->ctx_id = ctx->id;
DRM_DEBUG_DRIVER("HW context %d created\n", args->ctx_id);
- return PTR_RET(ctx);
+ return 0;
}
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
OpenPOWER on IntegriCloud