提交 2dc10cd8 编写于 作者: M Mika Kuoppala 提交者: Mika Kuoppala

drm/i915: Fix use after free when printing load failure

Commit d15d7538 ("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: NMika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1458721906-10625-1-git-send-email-mika.kuoppala@intel.com
上级 c6c794a2
...@@ -1398,10 +1398,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1398,10 +1398,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
intel_runtime_pm_put(dev_priv); intel_runtime_pm_put(dev_priv);
i915_driver_cleanup_early(dev_priv); i915_driver_cleanup_early(dev_priv);
out_free_priv: out_free_priv:
kfree(dev_priv);
i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret); i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
kfree(dev_priv);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册