Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3629618pxb; Mon, 24 Jan 2022 13:56:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJyjI7UvEqaxnGBrfxLdVypzdI7ruXKZPbuGmJTEP1L5K3t7KNqma9+y/gKObBU0Ee4bCCkg X-Received: by 2002:a05:6a00:1d93:b0:4c7:f78c:3f41 with SMTP id z19-20020a056a001d9300b004c7f78c3f41mr9827870pfw.54.1643061275722; Mon, 24 Jan 2022 13:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061275; cv=none; d=google.com; s=arc-20160816; b=ik1wo+qXIBRtaDBtXJVBJ7oezYpXdgRREAZD0gZ5AcCQ0+Ms1HlVlUvedghgAX+saS Dnmw2sF9LcsB2uAXXarcysAbcIz2rU9y/Ge1VpBMZGsHwEsMp4BU9KNvDDyPvsUfmP27 YoJgpSM9IDAhnHMw1pUF0qbrlDq5Q0YRl13cKAou1tSDuyyHGNQ9MjgKPoFU8SPu6zUZ Eb1zDuzDq7uES13wioAhHElhzGphg6RSI9EHMxtxoNLRBJD3eHg4ZVlCDLX+jV+4D+dL LFphWv2tz2CTQ6NPKqZV82yDQ6zyyL+gFVJv4pklN8V1w3OpIrviU9lY7yOjXCDYqavF 86Cw== 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=juVPU9XB7IHTIZR/B6estjiAi2q5obhtlg+Gjf6BwXc=; b=FPoQ9dZkwVq/pMZ1EuehZkj+WHCLU4rEQv/ZEr4xM/A5Ls1mtxsze7ICuHd/zzlEaJ IT6h377qFILQB9fwug6ODCS4dJD9DrzhrBFWy9pBaEqyRR+3dwai51jxxqXVxb04ZSCB vC+WuTwxzzIpeu2IxnwvXqglTIOfxjrG7EapfLL4RNTEedYtrPuBHp4SBt3Cbo0r5rXl D+nKVWiqenU5CwDANJR2oPpntYeO6vBvoMmpGdUsHGBBg5FErwuHmTYtRFG+IZKlGMev RzOH0NFyPosacnPxL7CCFsPLbITOSSBE2AcriSukyhB8wrDU/AKk5EIUfogZxnvXT6vb pmrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TpiXxUIs; 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 x62si6149830pgd.439.2022.01.24.13.54.20; Mon, 24 Jan 2022 13:54:35 -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=TpiXxUIs; 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 S1457728AbiAXVmM (ORCPT + 99 others); Mon, 24 Jan 2022 16:42:12 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58514 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354232AbiAXVFt (ORCPT ); Mon, 24 Jan 2022 16:05:49 -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 51A8161317; Mon, 24 Jan 2022 21:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 352E6C340E5; Mon, 24 Jan 2022 21:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058348; bh=Ae6xcvFdnKy3FwdPmiKqRI4OXQ4zHeuRYY0s4+yvNzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TpiXxUIsoAD2t9TfB9w1DZdU9sD5d3Z/hBsARP22sgwCjVRFMGXFQvBDqx2Qpaacc vpGjk5kATnBahR9sLtyITNOSBzZp0ax6OKWLiTmKlRq5LWwSzpvN6wiJqDgQ4U/Iwx qQyYaM5FDZS2K4PPQXhwneLGBGV9Np8flBJuC7Wo= 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.16 0259/1039] drm/amd/display: Fix out of bounds access on DNC31 stream encoder regs Date: Mon, 24 Jan 2022 19:34:08 +0100 Message-Id: <20220124184134.017744254@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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 27afbe6ec0fee..f969ff65f802b 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -493,7 +493,8 @@ static const struct dcn31_apg_mask apg_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