]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/i915: Do not access rq->engine without a reference
authorNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Tue, 14 Jun 2022 18:43:46 +0000 (00:13 +0530)
committerRamalingam C <ramalingam.c@intel.com>
Mon, 27 Jun 2022 18:16:35 +0000 (23:46 +0530)
In i915_fence_get_driver_name(), user may not hold a
reference to rq->engine. Hence do not access it. Instead,
store required device private pointer in 'rq->i915' and use it.

Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Ramalingam C <ramalingam.c@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220614184348.23746-2-ramalingam.c@intel.com
drivers/gpu/drm/i915/i915_request.c
drivers/gpu/drm/i915/i915_request.h

index c3937640b1199810c299131b0610608c816d8eed..667dda7668cb1bb81f12622be5e4b5995a4abb37 100644 (file)
@@ -60,7 +60,7 @@ static struct kmem_cache *slab_execute_cbs;
 
 static const char *i915_fence_get_driver_name(struct dma_fence *fence)
 {
-       return dev_name(to_request(fence)->engine->i915->drm.dev);
+       return dev_name(to_request(fence)->i915->drm.dev);
 }
 
 static const char *i915_fence_get_timeline_name(struct dma_fence *fence)
@@ -937,6 +937,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
        rq->engine = ce->engine;
        rq->ring = ce->ring;
        rq->execution_mask = ce->engine->mask;
+       rq->i915 = ce->engine->i915;
 
        ret = intel_timeline_get_seqno(tl, rq, &seqno);
        if (ret)
index 28b1f9db54875944d59d3a59b1e85c6ff16d4aa6..47041ec68df8982eb9be0d0269cb77b8ac44dfd7 100644 (file)
@@ -196,6 +196,8 @@ struct i915_request {
        struct dma_fence fence;
        spinlock_t lock;
 
+       struct drm_i915_private *i915;
+
        /**
         * Context and ring buffer related to this request
         * Contexts are refcounted, so when this request is associated with a