Skip to contentSkip to conversation

drm/i915: Fix use after free in logical_render_ring_init

PATCH In review Tvrtko Ursulin 4 participants 4 messages Dec 16, 2016

Subsystems (2)
lore
Share & tools
lore

Tvrtko Ursulin

author maintainer
#0 lore raw

PATCH 1/1 drm/i915: Fix use after free in logical_render_ring_init

From: Tvrtko Ursulin <[email protected]>

Commit 3b3f1650b1ca ("drm/i915: Allocate intel_engine_cs structure only for the enabled engines") introduced the dynanically allocated engine instances and created an potential use after free scenario in logical_render_ring_init where lrc_destroy_wa_ctx_obj could be called after the engine instance has been freed.

This can only happen during engine setup/init error handling which luckily does not happen ever in practice.

Fix is to not call lrc_destroy_wa_ctx_obj since it would have already been executed from the preceding engine cleanup.

Fixes 3b3f1650b1ca ("drm/i915: Allocate intel_engine_cs structure only for the enabled engines")
Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/intel_lrc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_lrc.c +1 -6
index 8b412880e88c..877adedbf833 100644
@@ -1965,12 +1965,7 @@ int logical_render_ring_init(struct intel_engine_cs *engine)
 			  ret);
 	}
 
-	ret = logical_ring_init(engine);
-	if (ret) {
-		lrc_destroy_wa_ctx_obj(engine);
-	}
-
-	return ret;
+	return logical_ring_init(engine);
 }
 
 int logical_xcs_ring_init(struct intel_engine_cs *engine)
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

Commit 3b3f1650b1ca ("drm/i915: Allocate intel_engine_cs structure only for the enabled engines") introduced the dynanically allocated engine instances and created an potential use after free scenario in logical_render_ring_init where lrc_destroy_wa_ctx_obj could be called after the engine instance has been freed.

This can only happen during engine setup/init error handling which luckily does not happen ever in practice.

Fix is to not call lrc_destroy_wa_ctx_obj since it would have already been executed from the preceding engine cleanup.

Quoted 8 lines
Fixes 3b3f1650b1ca ("drm/i915: Allocate intel_engine_cs structure only for the enabled engines")
Cc Chris Wilson <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Jani Nikula <[email protected]>

-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

✓ Fi.CI.BAT: success for drm/i915: Fix use after free in logical_render_ring_init

In reply to Tvrtko Ursulin
== Series Details ==

== Series Details ==

Series: drm/i915: Fix use after free in logical_render_ring_init
URL : https://patchwork.freedesktop.org/series/16918/
State : success

== Summary ==

Series 16918v1 drm/i915: Fix use after free in logical_render_ring_init
https://patchwork.freedesktop.org/api/1.0/series/16918/revisions/1/mbox/

Test gem_busy:

        Subgroup basic-hang-default:
                fail       -> PASS       (fi-hsw-4770r)
fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:247  pass:222  dwarn:0   dfail:0   fail:0   skip:25 
fi-bxt-t5700     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-j1900     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19 
fi-ilk-650       total:247  pass:195  dwarn:0   dfail:0   fail:0   skip:52 
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:247  pass:224  dwarn:3   dfail:0   fail:0   skip:20 
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32 

e5dd5ad8937cd82ea07bde765bde5b4c09d81dcb drm-tip: 2016y-12m-16d-09h-25m-11s UTC integration manifest 899a8cc4 drm/i915: Fix use after free in logical_render_ring_init

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3308/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: ✓ Fi.CI.BAT: success for drm/i915: Fix use after free in logical_render_ring_init

Quoted 34 lines · Patchwork

== Series Details ==

Series: drm/i915: Fix use after free in logical_render_ring_init
URL : https://patchwork.freedesktop.org/series/16918/
State : success

== Summary ==

Series 16918v1 drm/i915: Fix use after free in logical_render_ring_init
https://patchwork.freedesktop.org/api/1.0/series/16918/revisions/1/mbox/

Test gem_busy:

        Subgroup basic-hang-default:
                fail       -> PASS       (fi-hsw-4770r)
fi-bdw-5557u     total:247  pass:233  dwarn:0   dfail:0   fail:0   skip:14
fi-bsw-n3050     total:247  pass:208  dwarn:0   dfail:0   fail:0   skip:39
fi-bxt-j4205     total:247  pass:222  dwarn:0   dfail:0   fail:0   skip:25
fi-bxt-t5700     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27
fi-byt-j1900     total:247  pass:220  dwarn:0   dfail:0   fail:0   skip:27
fi-byt-n2820     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31
fi-hsw-4770      total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19
fi-hsw-4770r     total:247  pass:228  dwarn:0   dfail:0   fail:0   skip:19
fi-ilk-650       total:247  pass:195  dwarn:0   dfail:0   fail:0   skip:52
fi-ivb-3520m     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21
fi-ivb-3770      total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21
fi-kbl-7500u     total:247  pass:226  dwarn:0   dfail:0   fail:0   skip:21
fi-skl-6260u     total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13
fi-skl-6700hq    total:247  pass:227  dwarn:0   dfail:0   fail:0   skip:20
fi-skl-6700k     total:247  pass:224  dwarn:3   dfail:0   fail:0   skip:20
fi-skl-6770hq    total:247  pass:234  dwarn:0   dfail:0   fail:0   skip:13
fi-snb-2520m     total:247  pass:216  dwarn:0   dfail:0   fail:0   skip:31
fi-snb-2600      total:247  pass:215  dwarn:0   dfail:0   fail:0   skip:32
Quoted 2 lines

e5dd5ad8937cd82ea07bde765bde5b4c09d81dcb drm-tip: 2016y-12m-16d-09h-25m-11s UTC integration manifest 899a8cc4 drm/i915: Fix use after free in logical_render_ring_init

Pushed, thanks for the review.

Regards,

Tvrtko

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