Skip to content

Commit 9f035d1

Browse files
jhovoldgregkh
authored andcommitted
drm/msm/dsi: fix memory corruption with too many bridges
commit 2e786eb upstream. Add the missing sanity check on the bridge counter to avoid corrupting data beyond the fixed-sized bridge array in case there are ever more than eight bridges. Fixes: a689554 ("drm/msm: Initial add DSI connector support") Cc: [email protected] # 4.1 Signed-off-by: Johan Hovold <[email protected]> Tested-by: Kuogee Hsieh <[email protected]> Reviewed-by: Kuogee Hsieh <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/502668/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 986a89b commit 9f035d1

File tree

1 file changed

+6
-0
lines changed
  • drivers/gpu/drm/msm/dsi

1 file changed

+6
-0
lines changed

drivers/gpu/drm/msm/dsi/dsi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
212212
return -EINVAL;
213213

214214
priv = dev->dev_private;
215+
216+
if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
217+
DRM_DEV_ERROR(dev->dev, "too many bridges\n");
218+
return -ENOSPC;
219+
}
220+
215221
msm_dsi->dev = dev;
216222

217223
ret = msm_dsi_host_modeset_init(msm_dsi->host, dev);

0 commit comments

Comments
 (0)