Skip to content

Commit 74466e4

Browse files
jhovoldAbhinav Kumar
authored andcommitted
drm/msm/dp: 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: 8a3b4c1 ("drm/msm/dp: employ bridge mechanism for display enable and disable") Cc: [email protected] # 5.17 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/502664/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent 6808abd commit 74466e4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpu/drm/msm/dp/dp_display.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,12 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,
15971597
return -EINVAL;
15981598

15991599
priv = dev->dev_private;
1600+
1601+
if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
1602+
DRM_DEV_ERROR(dev->dev, "too many bridges\n");
1603+
return -ENOSPC;
1604+
}
1605+
16001606
dp_display->drm_dev = dev;
16011607

16021608
dp_priv = container_of(dp_display, struct dp_display_private, dp_display);

0 commit comments

Comments
 (0)