[PATCH] drm: Skip too big EDID extensions

2012-06-05 Thread Takashi Iwai
When the number of extension blocks in EDID is too big, it's more
likely a broken data, thus better to skip them.

We've got a bug report that a machine spews "invalid block EDID"
errors at boot for 400 times which delays the boot very much, and this
patch fixes it.  Certainly it's a hardware-specific problem, but it's
anyway safer to avoid such almost unrealistic setups.

Signed-off-by: Takashi Iwai 
---
 drivers/gpu/drm/drm_edid.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index eb92fe2..61e4cf1 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -321,6 +321,13 @@ drm_do_get_edid(struct drm_connector *connector, struct 
i2c_adapter *adapter)
if (i == 4)
goto carp;

+   if (block[0x7e] > 20) {
+   /* too many extensions -- something is wrong */
+   DRM_DEBUG_KMS("drm: %s: ignoring too many extensions %d\n",
+ adapter->name, block[0x7e]);
+   block[0x7e] = 0;
+   }
+
/* if there's no extensions, we're done */
if (block[0x7e] == 0)
return block;
-- 
1.7.10.3



[PATCH] drm: Skip too big EDID extensions

2012-06-05 Thread Takashi Iwai
When the number of extension blocks in EDID is too big, it's more
likely a broken data, thus better to skip them.

We've got a bug report that a machine spews "invalid block EDID"
errors at boot for 400 times which delays the boot very much, and this
patch fixes it.  Certainly it's a hardware-specific problem, but it's
anyway safer to avoid such almost unrealistic setups.

Signed-off-by: Takashi Iwai 
---
 drivers/gpu/drm/drm_edid.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index eb92fe2..61e4cf1 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -321,6 +321,13 @@ drm_do_get_edid(struct drm_connector *connector, struct 
i2c_adapter *adapter)
if (i == 4)
goto carp;
 
+   if (block[0x7e] > 20) {
+   /* too many extensions -- something is wrong */
+   DRM_DEBUG_KMS("drm: %s: ignoring too many extensions %d\n",
+ adapter->name, block[0x7e]);
+   block[0x7e] = 0;
+   }
+
/* if there's no extensions, we're done */
if (block[0x7e] == 0)
return block;
-- 
1.7.10.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel