Skip to content

Commit

Permalink
drm/i915/selftests: Avoid ERR_PTR dereference
Browse files Browse the repository at this point in the history
Along the early error path for igt_switch_to_kernel_context we may try
to dereference an invalid error pointer. Instead, return early rather
than dump the GEM trace since we haven't yet emitted anything of
interest.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 09a4c02 ("drm/i915: Look for an active kernel context before switching")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180620112441.13085-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Jun 20, 2018
1 parent ac2bf28 commit f648661
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/selftests/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,8 @@ static int igt_switch_to_kernel_context(void *arg)
mutex_lock(&i915->drm.struct_mutex);
ctx = kernel_context(i915);
if (IS_ERR(ctx)) {
err = PTR_ERR(ctx);
goto out_unlock;
mutex_unlock(&i915->drm.struct_mutex);
return PTR_ERR(ctx);
}

/* First check idling each individual engine */
Expand Down

0 comments on commit f648661

Please sign in to comment.