Skip to content

Commit 4c1294d

Browse files
jhovoldAbhinav Kumar
authored andcommitted
drm/msm/hdmi: 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: a3376e3 ("drm/msm: convert to drm_bridge") Cc: [email protected] # 3.12 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/502670/ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Abhinav Kumar <[email protected]>
1 parent 2e786eb commit 4c1294d

File tree

1 file changed

+5
-0
lines changed
  • drivers/gpu/drm/msm/hdmi

1 file changed

+5
-0
lines changed

drivers/gpu/drm/msm/hdmi/hdmi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
300300
struct platform_device *pdev = hdmi->pdev;
301301
int ret;
302302

303+
if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
304+
DRM_DEV_ERROR(dev->dev, "too many bridges\n");
305+
return -ENOSPC;
306+
}
307+
303308
hdmi->dev = dev;
304309
hdmi->encoder = encoder;
305310

0 commit comments

Comments
 (0)