]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Avoid using rq->engine after free during i915_fence_release
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 21 May 2020 14:06:17 +0000 (15:06 +0100)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Mon, 25 May 2020 12:40:39 +0000 (15:40 +0300)
commitc6fb1bb133d0ee6d64d6aa5d400d001293f98c0b
treed6f365bd85e0d01064d62bf34acf23caef769c3e
parent01327701a401eb2558ba60b7a7bf4615ea6c4b5d
drm/i915: Avoid using rq->engine after free during i915_fence_release

In order to be valid to dereference during the i915_fence_release, after
retiring the fence and releasing its refererences, we assume that
rq->engine can only be a real engine (that stay intact until the device
is shutdown after all fences have been flushed). However, due to a quirk
of preempt-to-busy, we may retire a request that still belongs to a
virtual engine and so eventually free it with rq->engine being invalid.
To avoid dereferencing that invalid engine, we look at the
execution_mask which if it indicates it may be executed on more than one
engine, we know it originated on a virtual engine and may still be on
one.

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/1906
Fixes: 1b976ace1542 ("drm/i915: Keep a per-engine request pool")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200521140617.30015-2-chris@chris-wilson.co.uk
(cherry picked from commit 32a4605b38c30689a6a18f3f4c7d3133ac9d3277)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_request.c