aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2018-05-31 14:48:58 -0400
committerRob Clark <robdclark@gmail.com>2018-06-04 12:50:42 -0400
commit74d3a3a70775de356b96b5461c3a204a51496fb3 (patch)
tree40705c1662d17f938b5a9991d3524fcd6b03f8db /drivers/gpu
parentd14659f5de7d2822764d6944ce7d8d7570ebfd9b (diff)
drm/msm: Fix NULL deref on bind/probe deferral
This patch avoids dereferencing msm_host->dev when it is NULL. If we find ourselves tearing down dsi before calling (mdp4|mdp5|dpu)_kms_init(), we'll end up in a state where the dev pointer is NULL and trying to extract priv from it will fail. This was introduced in a seemingly innocuous commit to ensure the arguments to msm_gem_put_iova() are correct (even though that function has been a stub for ~5 years). Correctness FTW! \o/ Fixes: b01884a286b0 drm/msm: use correct aspace pointer in msm_gem_put_iova() Cc: Daniel Mack <daniel@zonque.org> Cc: Rob Clark <robdclark@gmail.com> Signed-off-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_host.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index b916f464f4ec..2f1a2780658a 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1066,8 +1066,18 @@ static int dsi_tx_buf_alloc(struct msm_dsi_host *msm_host, int size)
1066static void dsi_tx_buf_free(struct msm_dsi_host *msm_host) 1066static void dsi_tx_buf_free(struct msm_dsi_host *msm_host)
1067{ 1067{
1068 struct drm_device *dev = msm_host->dev; 1068 struct drm_device *dev = msm_host->dev;
1069 struct msm_drm_private *priv = dev->dev_private; 1069 struct msm_drm_private *priv;
1070
1071 /*
1072 * This is possible if we're tearing down before we've had a chance to
1073 * fully initialize. A very real possibility if our probe is deferred,
1074 * in which case we'll hit msm_dsi_host_destroy() without having run
1075 * through the dsi_tx_buf_alloc().
1076 */
1077 if (!dev)
1078 return;
1070 1079
1080 priv = dev->dev_private;
1071 if (msm_host->tx_gem_obj) { 1081 if (msm_host->tx_gem_obj) {
1072 msm_gem_put_iova(msm_host->tx_gem_obj, priv->kms->aspace); 1082 msm_gem_put_iova(msm_host->tx_gem_obj, priv->kms->aspace);
1073 drm_gem_object_put_unlocked(msm_host->tx_gem_obj); 1083 drm_gem_object_put_unlocked(msm_host->tx_gem_obj);