drm/i915: Avoid use-after-free of ctx in request tracepoints
authorChris Wilson <chris@chris-wilson.co.uk>
Thu, 16 Mar 2017 20:42:35 +0000 (20:42 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Fri, 17 Mar 2017 07:59:48 +0000 (07:59 +0000)
commit60367132a21449c2119f0bb27eef907bc95828af
treecf92a398b9393c9f96f14775be1ba50ab5bcbc15
parenta533b4ba776c16bce53b9739c47409ed3cfe5776
drm/i915: Avoid use-after-free of ctx in request tracepoints

trace_i915_gem_request_out may be used after the request is completed,
and so the request may have been retired on another thread, invalidating
the rq->ctx. Avoid dereferencing rq->ctx in the tracepoint by switching
to the fence context id instead, updating all tracepoints to match.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170316204235.27786-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
drivers/gpu/drm/i915/i915_trace.h