Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932370AbcCBAaD (ORCPT ); Tue, 1 Mar 2016 19:30:03 -0500 Received: from mail333.us4.mandrillapp.com ([205.201.137.77]:58676 "EHLO mail333.us4.mandrillapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756347AbcCAX53 convert rfc822-to-8bit (ORCPT ); Tue, 1 Mar 2016 18:57:29 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; q=dns; s=mandrill; d=linuxfoundation.org; b=adNBDjeXD+Ks2HUqehb6qw6Oxj5QaLCqz46GyWHRUvWWv+Q5Ewi9MhPY72FxHptcEWZoctRGvsYH 6gqMvg2oSI/gUQLf5dnggTEsyQgZZa8SuKJUJvRWNmYIfSoDLWwzOjZibe/gITCE7dkbh9fPlpii uEDBEegVKzqXUInGO24=; From: Greg Kroah-Hartman Subject: [PATCH 4.4 224/342] drm/i915/dsi: defend gpio table against out of bounds access X-Mailer: git-send-email 2.7.2 To: Cc: Greg Kroah-Hartman , , =?utf-8?Q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula Message-Id: <20160301234535.170453114@linuxfoundation.org> In-Reply-To: <20160301234527.990448862@linuxfoundation.org> References: <20160301234527.990448862@linuxfoundation.org> X-Report-Abuse: Please forward a copy of this message, including all headers, to abuse@mandrill.com X-Report-Abuse: You can also report abuse here: http://mandrillapp.com/contact/abuse?id=30481620.baab2d590db24798a739e0dfe0c2bb28 X-Mandrill-User: md_30481620 Date: Tue, 01 Mar 2016 23:55:04 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1313 Lines: 42 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jani Nikula commit 4db3a2448ec8902310acb78de39b6227a9a56ac8 upstream. Do not blindly trust the VBT data used for indexing. Reviewed-by: Ville Syrjälä Signed-off-by: Jani Nikula Link: http://patchwork.freedesktop.org/patch/msgid/cc32d40c2b47f2d2151811855ac2c3dabab1d57d.1454582914.git.jani.nikula@intel.com (cherry picked from commit 5d2d0a12d3d08bf50434f0b5947bb73bac04b941) Signed-off-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 6 ++++++ 1 file changed, 6 insertions(+) --- 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 i /* 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 i vlv_gpio_nc_write(dev_priv, pad, val); mutex_unlock(&dev_priv->sb_lock); +out: return data; }