summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2016-02-04 12:50:49 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-03 15:07:22 -0800
commit7a35478f900a01650f00e39423722956d04daedd (patch)
treef49473114e0439e0a892d77f3ce3cb4a2e6b3fd8 /drivers
parent2f1e7d5f8f6b3f21db1423e15167e4350bd959d7 (diff)
downloadlinux-stable-7a35478f900a01650f00e39423722956d04daedd.tar.gz
linux-stable-7a35478f900a01650f00e39423722956d04daedd.tar.bz2
linux-stable-7a35478f900a01650f00e39423722956d04daedd.zip
drm/i915/dsi: defend gpio table against out of bounds access
commit 4db3a2448ec8902310acb78de39b6227a9a56ac8 upstream. Do not blindly trust the VBT data used for indexing. 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 (cherry picked from commit 5d2d0a12d3d08bf50434f0b5947bb73bac04b941) Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_dsi_panel_vbt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
index a5e99ac305da..349775e88e5b 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 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
/* 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 @@ static const u8 *mipi_exec_gpio(struct intel_dsi *intel_dsi, const u8 *data)
vlv_gpio_nc_write(dev_priv, pad, val);
mutex_unlock(&dev_priv->sb_lock);
+out:
return data;
}