From patchwork Fri Oct 13 07:06:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fli24 X-Patchwork-Id: 10003565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 37274602B3 for ; Fri, 13 Oct 2017 07:07:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2839F28FDB for ; Fri, 13 Oct 2017 07:07:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1D00D28FDD; Fri, 13 Oct 2017 07:07:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE8E528FDB for ; Fri, 13 Oct 2017 07:07:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C34236EA37; Fri, 13 Oct 2017 07:07:17 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4BFD6EA34 for ; Fri, 13 Oct 2017 07:07:02 +0000 (UTC) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Oct 2017 00:07:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,369,1503385200"; d="scan'208";a="909541769" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 13 Oct 2017 00:07:01 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 13 Oct 2017 00:07:01 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.152]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Fri, 13 Oct 2017 15:06:59 +0800 From: "Li, Fei" To: "intel-gfx@lists.freedesktop.org" Thread-Topic: [PATCH] drm/i915: check pin validity of VBT configuration Thread-Index: AdND8SZVCXgn5olSTS2/9oVpCNfUOg== Date: Fri, 13 Oct 2017 07:06:58 +0000 Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: check pin validity of VBT configuration X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); }