[Intel-gfx] [PATCH] drm/i915: Fix a use-after-free in intel_execlists_retire_requests

Nick Hoath nicholas.hoath at intel.com
Thu Jan 29 08:55:07 PST 2015


Remove request from list before unreferencing it, in case it's actually
the only reference. (Found by Tvrtko Ursulin)

Signed-off-by: Nick Hoath <nicholas.hoath at intel.com>
---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 70e449b..a94346f 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -732,8 +732,8 @@ void intel_execlists_retire_requests(struct intel_engine_cs *ring)
 			intel_lr_context_unpin(ring, ctx);
 		intel_runtime_pm_put(dev_priv);
 		i915_gem_context_unreference(ctx);
-		i915_gem_request_unreference(req);
 		list_del(&req->execlist_link);
+		i915_gem_request_unreference(req);
 	}
 }
 
-- 
2.1.1



More information about the Intel-gfx mailing list