Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3978236pxb; Tue, 25 Jan 2022 00:30:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJx57Bp9ZmQQeFObpKYOldtgWt26RUENaVlzvyg/u/bTFrSMrEbLCP76c77U4hNyCCdgTdET X-Received: by 2002:a05:6402:8c9:: with SMTP id d9mr6603065edz.54.1643099403980; Tue, 25 Jan 2022 00:30:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099403; cv=none; d=google.com; s=arc-20160816; b=vHUUlrbRamb4wFwxxx5xHwAYf43YmhmFvV2SD68Xc2LxpZ/PF2hPzkcuFsJa6twH+T k1W+wKduGYV8kgtz1M1LYgn5Oruj/Kr3TCqos2ZFGWq17yL6wYcWBXArxv7igUIwpmje gn7Ob4TM2JCsDBKT5WDD6RroPvIXSqRUTQS/oTmLOuRMQLoJh+rgzdui/g+pFe+MTNeH VBSrTlGqRKFTMpsIzYF+r9KjGsL5w5bUmSazT6E6n0DEM3TgMOF2oAXBcu2I2VX7VoRb oyWerJsCtE12cwlS8omHa7EW0JZBMpAFzcK6DStpV3M1aeqkerA4t+gWsOGrgP+4IycI cr7Q== 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=01aRTzuu58zGZUV96L/+yR7ZwvCkTXP10DYA4uinKCc=; b=Ako4BlM0ZMeGpzyNgDprGLnUJRcr043BTtLA2XPyqtWqP2gqcUrr05fN93b51b9Lci qRnoCbM+nSwROxt1QKmrxhnSf7kfzn+s+Kh6i76HldEU1SSlwT/oOJZJUhpZgDA3e+cn wUcps4IRX8wN18fPuvG14Ar0CbavMXITQziug07t3zudrfIwoxgv5lCyXn7ZVzdyHv9z XnTn9eSJCHkpV3EEjbVu/g9ReNCHsMIEOneLvhjaq6smr8BSivDizEL6b/d+MeXjLIJD j8sllywMgjIBq7LnVibrc/qfC5XNDvlwFlBbxfmbolTipJ8FNscdmZNNLtH/GMM/S6/a egrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmeRMhKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v13si10549449edb.457.2022.01.25.00.29.39; Tue, 25 Jan 2022 00:30:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VmeRMhKb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S3422892AbiAYCcW (ORCPT + 99 others); Mon, 24 Jan 2022 21:32:22 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:46344 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355957AbiAXUWL (ORCPT ); Mon, 24 Jan 2022 15:22:11 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7554C61382; Mon, 24 Jan 2022 20:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51286C340E5; Mon, 24 Jan 2022 20:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055730; bh=OEEiLG+MaqoQuKa893H/hE0g8O4Jt/RefZPNUva1qyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmeRMhKbTAPDi0Bzv0Z0cVkF7E/S5S9tc8dnpj83MvhC+6Xdd88tn/1x1MKNJTyb7 6J7byl8LO6AsvAk8g/gFk7SGasKSq5ySNzkaGAis9xt15sII72wqMcrpyzb+zWNzGc COVLOab7oNUPSd6xRriR+5e8ZO9ID5JCglfjUOEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Nicholas Kazlauskas , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 220/846] drm/amd/display: Fix out of bounds access on DNC31 stream encoder regs Date: Mon, 24 Jan 2022 19:35:37 +0100 Message-Id: <20220124184108.511512456@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Kazlauskas [ Upstream commit d374d3b493215d637b9e7be12a93f22caf4c1f97 ] [Why] During dcn31_stream_encoder_create, if PHYC/D get remapped to F/G on B0 then we'll index 5 or 6 into a array of length 5 - leading to an access violation on some configs during device creation. [How] Software won't be touching PHYF/PHYG directly, so just extend the array to cover all possible engine IDs. Even if it does by try to access one of these registers by accident the offset will be 0 and we'll get a warning during the access. Fixes: 2fe9a0e1173f ("drm/amd/display: Fix DCN3 B0 DP Alt Mapping") Reviewed-by: Harry Wentland Signed-off-by: Nicholas Kazlauskas Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c index 0fe570717ba01..d4fe5352421fc 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -470,7 +470,8 @@ static const struct dcn30_afmt_mask afmt_mask = { SE_DCN3_REG_LIST(id)\ } -static const struct dcn10_stream_enc_registers stream_enc_regs[] = { +/* Some encoders won't be initialized here - but they're logical, not physical. */ +static const struct dcn10_stream_enc_registers stream_enc_regs[ENGINE_ID_COUNT] = { stream_enc_regs(0), stream_enc_regs(1), stream_enc_regs(2), -- 2.34.1