Commit 6808abdb authored by Johan Hovold's avatar Johan Hovold Committed by Abhinav Kumar

drm/msm: fix use-after-free on probe deferral

The bridge counter was never reset when tearing down the DRM device so
that stale pointers to deallocated structures would be accessed on the
next tear down (e.g. after a second late bind deferral).

Given enough bridges and a few probe deferrals this could currently also
lead to data beyond the bridge array being corrupted.

Fixes: d28ea556 ("drm/msm: properly add and remove internal bridges")
Fixes: a3376e3e ("drm/msm: convert to drm_bridge")
Cc: stable@vger.kernel.org      # 3.12
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Tested-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
Reviewed-by: default avatarKuogee Hsieh <quic_khsieh@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/502665/
Link: https://lore.kernel.org/r/20220913085320.8577-2-johan+linaro@kernel.orgSigned-off-by: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
parent 0b33a33b
...@@ -247,6 +247,7 @@ static int msm_drm_uninit(struct device *dev) ...@@ -247,6 +247,7 @@ static int msm_drm_uninit(struct device *dev)
for (i = 0; i < priv->num_bridges; i++) for (i = 0; i < priv->num_bridges; i++)
drm_bridge_remove(priv->bridges[i]); drm_bridge_remove(priv->bridges[i]);
priv->num_bridges = 0;
pm_runtime_get_sync(dev); pm_runtime_get_sync(dev);
msm_irq_uninstall(ddev); msm_irq_uninstall(ddev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment