From: Chris Wilson Date: Wed, 8 Apr 2020 09:17:23 +0000 (+0100) Subject: drm/i915/selftests: Take an explicit ref for rq->batch X-Git-Tag: Ubuntu-5.13.0-19.19~5927^2~18^2~18 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=fbaa1229d354b05fd8156b1ec1a0c00f084f4324;p=mirror_ubuntu-jammy-kernel.git drm/i915/selftests: Take an explicit ref for rq->batch Since we are peeking into the batch object of the request, it is beholden on us to hold a reference to it. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1634 Signed-off-by: Chris Wilson Reviewed-by: Mika Kuoppala Link: https://patchwork.freedesktop.org/patch/msgid/20200408091723.28937-1-chris@chris-wilson.co.uk --- diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c index 57db3d0ffaf2..616d03506c2c 100644 --- a/drivers/gpu/drm/i915/gt/selftest_lrc.c +++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c @@ -2655,7 +2655,7 @@ static int create_gang(struct intel_engine_cs *engine, if (IS_ERR(rq)) goto err_obj; - rq->batch = vma; + rq->batch = i915_vma_get(vma); i915_request_get(rq); i915_vma_lock(vma); @@ -2679,6 +2679,7 @@ static int create_gang(struct intel_engine_cs *engine, return 0; err_rq: + i915_vma_put(rq->batch); i915_request_put(rq); err_obj: i915_gem_object_put(obj); @@ -2775,6 +2776,7 @@ static int live_preempt_gang(void *arg) err = -ETIME; } + i915_vma_put(rq->batch); i915_request_put(rq); rq = n; }