drm/msm/dp: Free resources after unregistering them
authorBjorn Andersson <quic_bjorande@quicinc.com>
Mon, 12 Jun 2023 22:02:59 +0000 (15:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Jul 2023 14:21:31 +0000 (16:21 +0200)
commit4e9f1a2367aea7d61f6781213e25313cd983b0d7
tree4f2aaaed499fcea1792c1a01b65007b5bbdd3e8e
parentecf02762d4763bd5efa68b52a3592b4face7c166
drm/msm/dp: Free resources after unregistering them

[ Upstream commit fa0048a4b1fa7a50c8b0e514f5b428abdf69a6f8 ]

The DP component's unbind operation walks through the submodules to
unregister and clean things up. But if the unbind happens because the DP
controller itself is being removed, all the memory for those submodules
has just been freed.

Change the order of these operations to avoid the many use-after-free
that otherwise happens in this code path.

Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support")
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/542166/
Link: https://lore.kernel.org/r/20230612220259.1884381-1-quic_bjorande@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/dp/dp_display.c