Skip to contentSkip to conversation

drm/i915: Fix a use-after-free in intel_execlists_retire_requests

PATCH Applied Nick Hoath 4 participants 6 messages Jan 29, 2015 – Jan 31, 2015

Subsystems (2)
lore
Share & tools
lore

Nick Hoath

author
#0 lore raw

PATCH 1/1 drm/i915: Fix a use-after-free in intel_execlists_retire_requests

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

---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 70e449b..a94346f 100644
@@ -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);
 	}
 }
 
Signature · 6 lines
2.1.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Nick Hoath

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

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_lrc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -1
index 70e449b..a94346f 100644
@@ -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);
 	}
 }
 
Signature · 6 lines
2.1.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 6 lines · Mika Kuoppala
Quoted 4 lines · Nick Hoath

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

Do we have a Bugzilla: or similar report? Also when fixing a regression please dig out the offending original commit from the history. Though in this case here I'm not sure whether it is one ...

Please reply with this information so that I can amend the commit message.

Quoted 1 line

Queued for -next, thanks for the patch.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#3 lore raw
Quoted 9 lines · Daniel Vetter
Quoted 6 lines · Mika Kuoppala
Quoted 4 lines · Nick Hoath

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

Do we have a Bugzilla: or similar report? Also when fixing a regression

There's no bug report.

Quoted 2 lines

please dig out the offending original commit from the history. Though in this case here I'm not sure whether it is one ...

I guess the closest thing to an offending commit is 6d3d8274bc45de4babb62d64562d92af984dd238 drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request

Quoted 8 lines

Please reply with this information so that I can amend the commit message.

Quoted 1 line

Queued for -next, thanks for the patch.
-Daniel

Cheers,
Nick
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 9 lines · Nick Hoath
Quoted 8 lines · Daniel Vetter
Quoted 6 lines · Mika Kuoppala
Quoted 3 lines · Nick Hoath

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

Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line

Do we have a Bugzilla: or similar report? Also when fixing a regression

There's no bug report.

Hm, would have expected one ... maybe just stuck somewhere.

Quoted 6 lines
Quoted 2 lines

please dig out the offending original commit from the history. Though in this case here I'm not sure whether it is one ...

I guess the closest thing to an offending commit is 6d3d8274bc45de4babb62d64562d92af984dd238 drm/i915: Subsume intel_ctx_submit_request in to drm_i915_gem_request

Thanks a lot, added.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#5 lore raw
In reply to Nick Hoath

Task id: 5684 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied

PNV                                  353/353              353/353
ILK                                  200/200              200/200
SNB                                  400/422              400/422
IVB              +2                 485/487              487/487
BYT                                  296/296              296/296
HSW              +1                 507/508              508/508
BDW                 -2              401/402              399/402
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 IVB  igt_gem_pwrite_pread_snooped-pwrite-blt-cpu_mmap-performance      DMESG_WARN(6, M34M21)PASS(8, M4M34)      PASS(1, M4)
 IVB  igt_gem_storedw_batches_loop_normal      DMESG_WARN(5, M34M4)PASS(15, M34M4M21)      PASS(1, M4)
 HSW  igt_gem_pwrite_pread_snooped-pwrite-blt-cpu_mmap-performance      DMESG_WARN(1, M40)PASS(18, M40M20)      PASS(1, M20)
 BDW  igt_gem_pwrite_pread_display-pwrite-blt-gtt_mmap-performance      DMESG_WARN(4, M28)PASS(2, M30)      DMESG_WARN(1, M28)
*BDW  igt_gem_pwrite_pread_uncached-pwrite-blt-gtt_mmap-performance      PASS(6, M30M28)      DMESG_WARN(1, M28)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx