Skip to content

Commit b48949a

Browse files
jhovoldgregkh
authored andcommitted
drm/msm/hdmi: fix memory corruption with too many bridges
commit 4c1294d 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: 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9f035d1 commit b48949a

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
@@ -295,6 +295,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi,
295295
struct platform_device *pdev = hdmi->pdev;
296296
int ret;
297297

298+
if (priv->num_bridges == ARRAY_SIZE(priv->bridges)) {
299+
DRM_DEV_ERROR(dev->dev, "too many bridges\n");
300+
return -ENOSPC;
301+
}
302+
298303
hdmi->dev = dev;
299304
hdmi->encoder = encoder;
300305

0 commit comments

Comments
 (0)