commit | 5d2d0a12d3d08bf50434f0b5947bb73bac04b941 | [log] [tgz] |
---|---|---|
author | Jani Nikula <jani.nikula@intel.com> | Thu Feb 04 12:50:49 2016 +0200 |
committer | Jani Nikula <jani.nikula@intel.com> | Thu Feb 04 18:30:25 2016 +0200 |
tree | d4d5f6b1dac3e1c580dcfc8a13a3d3aedacb793c | |
parent | 5375ce9f38291c1d725db40519465dfe89c60ea9 [diff] |
drm/i915/dsi: defend gpio table against out of bounds access Do not blindly trust the VBT data used for indexing. Cc: stable@vger.kernel.org Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/cc32d40c2b47f2d2151811855ac2c3dabab1d57d.1454582914.git.jani.nikula@intel.com
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c index 1d43e6f..4775aa5 100644 --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
@@ -209,6 +209,11 @@ /* pull up/down */ action = *data++; + if (gpio >= ARRAY_SIZE(gtable)) { + DRM_DEBUG_KMS("unknown gpio %u\n", gpio); + goto out; + } + function = gtable[gpio].function_reg; pad = gtable[gpio].pad_reg; @@ -226,6 +231,7 @@ vlv_gpio_nc_write(dev_priv, pad, val); mutex_unlock(&dev_priv->sb_lock); +out: return data; }