On Tue, Jul 17, 2012 at 09:44:49AM +0300, Dan Carpenter wrote: > We need to check that "ctx" is a valid pointer before dereferencing it. > > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Queued for drm-intel-next, thanks for the patch. -Daniel > --- > Applies to linux-next. > > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c > index 9ae3f2c..a82c0ec 100644 > --- a/drivers/gpu/drm/i915/i915_gem_context.c > +++ b/drivers/gpu/drm/i915/i915_gem_context.c > @@ -496,11 +496,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, -- Daniel Vetter Mail: daniel@xxxxxxxx Mobile: +41 (0)79 365 57 48 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel