Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp820740rwb; Mon, 26 Sep 2022 06:20:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7CnaKa6iwv5m+p44X0HSTf4GgkLLX4FHINaIMB3jzDowRtkeqeGzSeSGLN0Q3bqsZPDLOc X-Received: by 2002:a17:907:94d0:b0:783:d969:f30c with SMTP id dn16-20020a17090794d000b00783d969f30cmr750993ejc.165.1664198409822; Mon, 26 Sep 2022 06:20:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664198409; cv=none; d=google.com; s=arc-20160816; b=q9/crykFb0R7QSmpzgYC78/ZL46mNS7LECs7a63+vcyRfBj31+fLA7kM/hHjGzpNpW Z7MwKpYGZ9TeptDTPYCR5tBeJRH9wgLQntdZoibqmXlCWWtcpFOUzLERD1RgAPbVVQvB gaLLKUpnJtGEilf0vnn31h+BZ7JpGqfh3aNRZdLJk99kVeVO0Xze87QHm6T8eFFcp0rt 0U3fi1NfyISUumtF1caBEqEf13G1Vy9RGQhDtmJ07sc7SZB5m4wqk0zLg2pQ6rpqhNcz 75rckH+3O+FzcOr3BchcX/a5/nrzcUc0aDTtkGw215xQUnX4nl7s8F5x6UyMHIlLlsOD CuVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VTDeIgNz2BtnYIAV/nFGYBca/4PlDtj10RaLE+0f/JQ=; b=feEqgz0XGCC3h1N/bpvwSbi78wP9n73tphJwX3Do1Tq5WcIQGfas5z+OiOeiZHyzVH ofGI9brejxg5p68Xt2JrbQQfYwYM3+X9tt1sM5nojodSkMMXQhxlDkPtZKqR7417XOJ7 DZLWLVksbEpiMTUaw7IVeiTHDwnn8mK2Ug5JNSoxFGFvxkINJ5s/BRunqZup33fYl2t0 0F6Kt2zSEAewtSR4al4sxX0MUnsT70dpIXxtgi/QzvA6D6Qe4FbhzicscM+nEsugGqLY 3GqcFiRbCnzALzsVd5t/ol/mU67B0Um16WaBIHH7O2OUO6u8sUaAUlZT/g9Sn8bN64Ae Rbfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VuBD3P4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hb44-20020a170907162c00b0078309fc9477si6066796ejc.439.2022.09.26.06.19.43; Mon, 26 Sep 2022 06:20:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VuBD3P4Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238759AbiIZL7h (ORCPT + 99 others); Mon, 26 Sep 2022 07:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238295AbiIZL4F (ORCPT ); Mon, 26 Sep 2022 07:56:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3070158B75; Mon, 26 Sep 2022 03:51:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6D66CB80957; Mon, 26 Sep 2022 10:42:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7017C433D6; Mon, 26 Sep 2022 10:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188977; bh=26rK1kT3JNgahVb+nuTchRLpOamrvO85/nRG2gjSRoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuBD3P4YZTkqL489sIr31ga/KaANaB68npQ22M8fAPaPb/QdwU4qJxDZxB+zsoOsV /qNLNDtVwOLiScucdOAJLIIF83nhNblpDi8GhkTz9So4h/lXIGBUCcun+h4gbykVWi RkdsHVMdi+NsN35mvlydMmdXuaVOfWX6XYLcm3T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jani Nikula , Stanislav Lisovskiy , Rodrigo Vivi , Sasha Levin Subject: [PATCH 5.19 006/207] drm/i915/dsi: filter invalid backlight and CABC ports Date: Mon, 26 Sep 2022 12:09:55 +0200 Message-Id: <20220926100806.775793933@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jani Nikula [ Upstream commit 607f41768a1ef9c7721866b00fbdeeea5359bc07 ] Avoid using ports that aren't initialized in case the VBT backlight or CABC ports have invalid values. This fixes a NULL pointer dereference of intel_dsi->dsi_hosts[port] in such cases. Cc: stable@vger.kernel.org Signed-off-by: Jani Nikula Reviewed-by: Stanislav Lisovskiy Link: https://patchwork.freedesktop.org/patch/msgid/b0f4f087866257d280eb97d6bcfcefd109cc5fa2.1660664162.git.jani.nikula@intel.com (cherry picked from commit f4a6c7a454a6e71c5ccf25af82694213a9784013) Signed-off-by: Rodrigo Vivi Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/display/icl_dsi.c | 7 +++++++ drivers/gpu/drm/i915/display/vlv_dsi.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c index 5c46acb46516..f416499dad6f 100644 --- a/drivers/gpu/drm/i915/display/icl_dsi.c +++ b/drivers/gpu/drm/i915/display/icl_dsi.c @@ -2072,7 +2072,14 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) else intel_dsi->ports = BIT(port); + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; + intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; + + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; + intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; for_each_dsi_port(port, intel_dsi->ports) { diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c index be8fd3c362df..02f75e95b2ec 100644 --- a/drivers/gpu/drm/i915/display/vlv_dsi.c +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c @@ -1933,7 +1933,14 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) else intel_dsi->ports = BIT(port); + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; + intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; + + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; + intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; /* Create a DSI host (and a device) for each port. */ -- 2.35.1