Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3810083ybi; Mon, 29 Jul 2019 13:04:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5hSLBd+GWAvD07F/6GgeBZ/bcNzRAPQb2z2/jHMX/l+5zOWIIl8CnyDtF+g78iqUyrN5K X-Received: by 2002:a17:902:bd94:: with SMTP id q20mr101525214pls.307.1564430672188; Mon, 29 Jul 2019 13:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564430672; cv=none; d=google.com; s=arc-20160816; b=nI2PlA0EhSvQuEfpkPJGM1EPiNWrpEpqwNlcj0cBw2oLoUXlPsZ5WUgL+JUt85ySgN y1ugF+A6s9NVuzzy+/FaiRNOKgdOG2N/PHqfolhPkoEsavY1f811exFqBcVpW9sge/Fb i29uG5eUAP5xUIT3HMUusth6xQ7lHsI8pdvMdvc6YHyUsk0Fedf89ZLj3XGqNPw7TzZL nOw3SNvwFjffjkDC+zeuAxxPyiT/u2lVqs7FRn+nwUMq8uttGRYWr7ofFX6AQYfq5LFk oj3FRaAEFzhwP4+mchR9gEMgE7BrYUL50KQnDtkY5iMRMnzt/kTiumXqUBAWWdYoa2CP qFtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hkDxxazUFXvpC0gzS1F2VkxaNiJWZMG4mgJGgMWAshs=; b=OtVstNx/Ip9B5Bh4GDp8ye2Im07YV94Fb39lbTFi5pzy09vwa8P0EGT2h0S/wjpNuw keDQdIZHTkTcfwwBoQOd5+P3LvxHYZyUBeG7tv/4LxNnSZsNIrHo6Qe1YOEYVV7g6uqr cch633SjKxi2NPgj57rvJwJFFlWhmuRt8hK5MVc3X9gcwzMtQj6GjLgA4g45uhjtxOks kkeVBBdk1hQRXVDcBkp6veMXaIKJTN9LR41v2N0VW9Ew7jj+tUxhVmJ7ZuoUOP96UEhG bNumzGT0sRkawaVLfUsg1kPjmXwxu7JHV/a9XEl3V3wOgTT+oa+iLjr9L8Pqbmx9N/jz KOgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wQweiBoP; 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 q187si26853994pfb.51.2019.07.29.13.04.17; Mon, 29 Jul 2019 13:04:32 -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; dkim=pass header.i=@kernel.org header.s=default header.b=wQweiBoP; 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 S2390587AbfG2UDH (ORCPT + 99 others); Mon, 29 Jul 2019 16:03:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:37498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390005AbfG2Trl (ORCPT ); Mon, 29 Jul 2019 15:47:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6FC87205F4; Mon, 29 Jul 2019 19:47:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564429660; bh=nlbEM+C31Ewvk88+a7TVEKpVhmC0Uit7jhVjrRoaNi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wQweiBoPTWuHGl+MoohzqADkTd3ROxnVGcDFUnfP823fZ2g/1yDfaDyRO4yyT+bAM RC5ir4Uw0L3VjqGt3Gztqm1y11xxYu5dQftJXhhSJ5bB5LTwk5unFtIsPxZv0jKKDa 9i5/fj1+D1dcfrDMTMBC91pVsCPIZIgnwfxBDZFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Leo Li , Alex Deucher , Sasha Levin Subject: [PATCH 5.2 054/215] drm/amd/display: Always allocate initial connector state state Date: Mon, 29 Jul 2019 21:20:50 +0200 Message-Id: <20190729190749.888823339@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190739.971253303@linuxfoundation.org> References: <20190729190739.971253303@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f04bee34d6e35df26cbb2d65e801adfd0d8fe20d ] [Why] Unlike our regular connectors, MST connectors don't start off with an initial connector state. This causes a NULL pointer dereference to occur when attaching the bpc property since it tries to modify the connector state. We need an initial connector state on the connector to avoid the crash. [How] Use our reset helper to allocate an initial state and reset the values to their defaults. We were already doing this before, just not for MST connectors. Signed-off-by: Nicholas Kazlauskas Reviewed-by: Leo Li Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 0e482349a5cb..dc3ac66a4450 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4627,6 +4627,13 @@ void amdgpu_dm_connector_init_helper(struct amdgpu_display_manager *dm, { struct amdgpu_device *adev = dm->ddev->dev_private; + /* + * Some of the properties below require access to state, like bpc. + * Allocate some default initial connector state with our reset helper. + */ + if (aconnector->base.funcs->reset) + aconnector->base.funcs->reset(&aconnector->base); + aconnector->connector_id = link_index; aconnector->dc_link = link; aconnector->base.interlace_allowed = false; @@ -4809,9 +4816,6 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm, &aconnector->base, &amdgpu_dm_connector_helper_funcs); - if (aconnector->base.funcs->reset) - aconnector->base.funcs->reset(&aconnector->base); - amdgpu_dm_connector_init_helper( dm, aconnector, -- 2.20.1