summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@linux.intel.com>2016-03-23 10:31:46 +0200
committerMika Kuoppala <mika.kuoppala@intel.com>2016-03-23 12:00:16 +0200
commit2dc10cd8bc2662d0311224d92fb82f34be0424bc (patch)
treec308c1b90084d77d38ac5cc7c67e8f5bebc18d08 /drivers/gpu/drm/i915/i915_dma.c
parentc6c794a2fc5e3bc8976fa318fbc7a003ecd712a1 (diff)
drm/i915: Fix use after free when printing load failure
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> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/1458721906-10625-1-git-send-email-mika.kuoppala@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c4
1 files 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;
}