[Intel-gfx] [PATCH] drm/i915: check pin validity of VBT configuration

Li, Fei fei.li at intel.com
Fri Oct 13 07:06:58 UTC 2017


In this patch, add validity checking of pin configuration from VBT;
If invalid, print log, ignore the configuration.

Without this patch, in case of invalid pin configured by VBT, panic is hit:
[   45.778820] WARN_ON(!intel_gmbus_is_valid_pin(dev_priv, pin))
[   45.778820] ------------[ cut here ]------------
[   45.778820] WARNING: CPU: 0 PID: 14 at
drivers/gpu/drm/i915/intel_i2c.c:754 intel_gmbus_get_adapter+0x43/0x50
[   45.848470] BUG: unable to handle kernel NULL pointer dereference
at 0000000000000010
[   45.848470] IP: i2c_transfer+0x15/0xc0
[   45.848470]  drm_do_probe_ddc_edid+0xe4/0x160
[   45.848470]  drm_get_edid+0x351/0x3d0
[   45.848470]  ? drm_get_edid+0x5/0x3d0
[   45.848470]  ? intel_gmbus_get_adapter+0x45/0x50
[   45.848470]  intel_hdmi_set_edid+0x4a/0x1a0

Signed-off-by: Li, Fei <fei.li at intel.com>
---
 drivers/gpu/drm/i915/intel_bios.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 2afcc52..f9ce156 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1199,6 +1199,12 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
 			info->alternate_ddc_pin = 0;
 		}
 
+                if (!intel_gmbus_is_valid_pin(dev_priv, info->alternate_ddc_pin)) {
+                        DRM_ERROR("pin %d is invalid for port %c, ignore it\n",
+                            info->alternate_ddc_pin, port_name(port));
+                        info->alternate_ddc_pin = 0;
+                }
+
 		sanitize_ddc_pin(dev_priv, port);
 	}
 
-- 
1.9.1


Thanks a lot!

Best Regards,
Fei


More information about the Intel-gfx mailing list