Skip to content

Commit 2e786eb

Browse files
jhovoldAbhinav Kumar
authored andcommitted
drm/msm/dsi: fix memory corruption with too many bridges
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]>
1 parent 74466e4 commit 2e786eb

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
@@ -218,6 +218,12 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
218218
return -EINVAL;
219219

220220
priv = dev->dev_private;
221+
222+
if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
223+
DRM_DEV_ERROR(dev->dev, "too many bridges\n");
224+
return -ENOSPC;
225+
}
226+
221227
msm_dsi->dev = dev;
222228

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

0 commit comments

Comments
 (0)