All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix use after free when printing load failure
@ 2016-03-23  8:31 Mika Kuoppala
  2016-03-23  8:32 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2016-03-23  8:56 ` [PATCH] " Chris Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Mika Kuoppala @ 2016-03-23  8:31 UTC (permalink / raw)
  To: intel-gfx

Commit d15d7538c6d2 ("drm/i915: Tune down init error message due
to failure injection") added i915_load_error message to failure
path on device initialization. The message is printed
after the device is freed. And as the message printing helper
uses the device structure, this leads to use after free.

Spotted by Kasan.

Cc: Imre Deak <imre.deak@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_dma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index a3458fcd83dc..fc8ac98c12d7 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1398,10 +1398,10 @@ out_runtime_pm_put:
 	intel_runtime_pm_put(dev_priv);
 	i915_driver_cleanup_early(dev_priv);
 out_free_priv:
-	kfree(dev_priv);
-
 	i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
 
+	kfree(dev_priv);
+
 	return ret;
 }
 
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-23 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-23  8:31 [PATCH] drm/i915: Fix use after free when printing load failure Mika Kuoppala
2016-03-23  8:32 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-03-23  9:01   ` Mika Kuoppala
2016-03-23  8:56 ` [PATCH] " Chris Wilson
2016-03-23 10:12   ` Mika Kuoppala

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.