Skip to content

Commit

Permalink
drm/i915: fix pm refcounting on fence error in execbuf
Browse files Browse the repository at this point in the history
Fences are creted/checked before the pm ref is taken, so if we jump to
pre_mutex_err we will uncorrectly call intel_runtime_pm_put.

v2: Massage unwind error paths

Fixes: fec0445 (drm/i915: Support explicit fencing for execbuf)
Testcase: igt/gem_exec_params
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1486161930-11764-1-git-send-email-daniele.ceraolospurio@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Daniele Ceraolo Spurio authored and Chris Wilson committed Feb 4, 2017
1 parent 955b8e9 commit 4a04e37
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1644,18 +1644,15 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,

if (args->flags & I915_EXEC_FENCE_IN) {
in_fence = sync_file_get_fence(lower_32_bits(args->rsvd2));
if (!in_fence) {
ret = -EINVAL;
goto pre_mutex_err;
}
if (!in_fence)
return -EINVAL;
}

if (args->flags & I915_EXEC_FENCE_OUT) {
out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
if (out_fence_fd < 0) {
ret = out_fence_fd;
out_fence_fd = -1;
goto pre_mutex_err;
goto err_in_fence;
}
}

Expand Down Expand Up @@ -1878,6 +1875,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
intel_runtime_pm_put(dev_priv);
if (out_fence_fd != -1)
put_unused_fd(out_fence_fd);
err_in_fence:
dma_fence_put(in_fence);
return ret;
}
Expand Down

0 comments on commit 4a04e37

Please sign in to comment.