Received: by 10.192.165.156 with SMTP id m28csp63140imm; Tue, 10 Apr 2018 16:27:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MKf7nAFqY9oAioGhSQFMjRFPlv+9fHIEHOxz2CWS6ZiZCl5ASvWSml9H0rnjAtD7FsnJA X-Received: by 10.101.87.138 with SMTP id b10mr1649624pgr.241.1523402862356; Tue, 10 Apr 2018 16:27:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523402862; cv=none; d=google.com; s=arc-20160816; b=WdGMuhjp11JNBzgl6FT7kpkCZsBV76yeFsNRywgd0R8oU5/cmRLc56WCxEURxhgG4v 5nmjpmsigpUCb50il8SNMn+E8AXgFiXXleWSoNsMnoPI+4xy6TvRjPDhvuPGB09oO+cr LLFdv76UOge9JZyumyJmNCDLQVyUI/p3m3gjy/tFf6I3UR4IIf/rD8pyCuCOvt4ulBOs 85ZuKXC5MqTJXz+HK9k08iN5smg3yaXdXuohnoXPZMOS6LpEs8U6u3/3bubF3I9Tl+V8 RySzLLTUgcYj0Ew1NQdUOUpfC0yTwCudJsoKnJxs4nNAnZp3DVdyq9RdzYc4QwGGARRv WEag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=s/pYd60673XmALbZbXJYTCn4CyznjWkLxHnWEBvOOaI=; b=02n/PsWXyjjPvO8sM9C3DxmZViSX0+JSRCtdXmIIud8AUyRvxvLBc9hNj+kf1bEK8w eQElCAB+omsMPc3RY1EF3ljXSnuBalHR/2o20hgL/cv470rS3z52VgU+1S38pWA+4ev7 uZXvBYN94y81/lwS+wgeOGwzaGBvT3Y/Hq3auJ7dHGVybpmPvCGwVDu7JWNX8sYq8NTA GgOIa04FDQmFTjdYHPxRV+UucMQVxSdd3lNcift9j6xUV5IxJStqaZ2oEOERn1QgZx5q fFOXDb4Vmo6OCh/tsOJeNj3RvIayau+08jn0gs4MS0fAbPzKFC4vATt8bBK9dgDNYEDm odUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k64si2834373pfj.262.2018.04.10.16.27.05; Tue, 10 Apr 2018 16:27:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754643AbeDJWan (ORCPT + 99 others); Tue, 10 Apr 2018 18:30:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40074 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752759AbeDJWak (ORCPT ); Tue, 10 Apr 2018 18:30:40 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A2E70DE6; Tue, 10 Apr 2018 22:30:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Radhakrishna Sripada , Jani Nikula , Kai Heng Feng , Lucas De Marchi , Rodrigo Vivi Subject: [PATCH 4.15 108/168] drm/i915/cnp: Properly handle VBT ddc pin out of bounds. Date: Wed, 11 Apr 2018 00:24:10 +0200 Message-Id: <20180410212804.844814404@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rodrigo Vivi commit 6e3322c226f15bc1838007f5a75566f1482b8e40 upstream. If the table result is out of bounds on the array map there is something really wrong with VBT pin so we don't return that vbt_pin, but only return 0 instead. This basically reverts commit 'a8e6f3888b05 ("drm/i915/cnp: Ignore VBT request for know invalid DDC pin.")' Also this properly fixes commit 9c3b2689d01f ("drm/i915/cnl: Map VBT DDC Pin to BSpec DDC Pin.") v2: Do in a way that we don't break other platforms. (Jani) v3: Keep debug message (Jani) v4: Don't mess with 0 mapping was noticed by Jani and addressed with a simple solution suggested by Lucas that makes this even simpler. Fixes: a8e6f3888b05 ("drm/i915/cnp: Ignore VBT request for know invalid DDC pin.") Fixes: 9c3b2689d01f ("drm/i915/cnl: Map VBT DDC Pin to BSpec DDC Pin.") Cc: Radhakrishna Sripada Cc: Jani Nikula Cc: Kai Heng Feng Cc: Lucas De Marchi Suggested-by: Lucas De Marchi Signed-off-by: Rodrigo Vivi Reviewed-by: Lucas De Marchi Tested-by: Kai-Heng Feng Link: https://patchwork.freedesktop.org/patch/msgid/20180125222524.22059-1-rodrigo.vivi@intel.com (cherry picked from commit 3393ce1ed8fc43dbdb83952facaf04e644ca1d54) Signed-off-by: Rodrigo Vivi Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/i915/intel_bios.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c @@ -1107,6 +1107,7 @@ static void sanitize_aux_ch(struct drm_i } static const u8 cnp_ddc_pin_map[] = { + [0] = 0, /* N/A */ [DDC_BUS_DDI_B] = GMBUS_PIN_1_BXT, [DDC_BUS_DDI_C] = GMBUS_PIN_2_BXT, [DDC_BUS_DDI_D] = GMBUS_PIN_4_CNP, /* sic */ @@ -1116,9 +1117,9 @@ static const u8 cnp_ddc_pin_map[] = { static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin) { if (HAS_PCH_CNP(dev_priv)) { - if (vbt_pin > 0 && vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map)) + if (vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map)) { return cnp_ddc_pin_map[vbt_pin]; - if (vbt_pin > GMBUS_PIN_4_CNP) { + } else { DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n", vbt_pin); return 0; }