Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp708360pxv; Thu, 15 Jul 2021 14:04:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKYtUrbYuNU+3wuq8Z/C4Lon/f5Tyllnw3ayUIiAwqnEt+GBy8M0WNQl5TdgPlwPVkSeqy X-Received: by 2002:a50:fa94:: with SMTP id w20mr9690851edr.275.1626383081957; Thu, 15 Jul 2021 14:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383081; cv=none; d=google.com; s=arc-20160816; b=YI1h7a19yUCBIBcohUriWxoSNi/TMFNkk2dY/8urnJJU+vFmFrfLIAJzU+nhOQjPAF 57clE8O9hQau6KQW0UXc5Lx18XQwP2MsbVXuJWaM1mwDkMcXeKC/qws8UXK4p7zVDDDI NojwLtMu1O8Li/Ynj5vm9QRq4NC2HpHlFhsMbIvGa4g79UjjJR7BsPNX0oQz54hAZxm1 2Bc1AQ34kpA1vAR5L7rp0SP2W8psSUBh7dP6UkqkS2G99ZN9E1kUvxcqE0tj3VPs5HR6 tUoAoG1OP2V/MIRQx0sGrKfDTF44bMotLh/ymRxUYqNlxYo7R3n3Cy6Ux+UmljWyhN3F h+Ng== 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=smJ9Nc250sV2ixBVmLc3qDnWLrEpnoGvCo9j4qnGBYU=; b=rwgl2OcFPYiG1xMTll65AjlCB6tg/uQ9Hd8OzM7Kjqfkx08gOmmuC4oB2A+6r+7cq7 F2Yr/sO930LgN9WwmaiIu1EWARZyhaewCwdTzHJH5xysi74vFZKY4TZEJ/y82TExQqx/ S4lfpHZdXVxqtmKv+EWBhoD/w22O/t4gzAV4F8rb3NhMSH0nsVnEWgG1Ox2CZW65nwy5 GSYm5y7jOBiUdy2qXXJcicIvQ3/m/d312/wUGXMCIMGJe/QqN6NDsRW44vB1fZtT0Anm LPfDFVXpZDhxoDM3iR2T8Vp3fLPxBJbnNHHdYBzNclrIsPiQnWqu/75oeGB23i801B5l SugA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KAAuZ2PT; 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 s17si8448182ejz.534.2021.07.15.14.04.19; Thu, 15 Jul 2021 14:04:41 -0700 (PDT) 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=KAAuZ2PT; 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 S243704AbhGOTPZ (ORCPT + 99 others); Thu, 15 Jul 2021 15:15:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:38862 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243237AbhGOTBq (ORCPT ); Thu, 15 Jul 2021 15:01:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9855E613E7; Thu, 15 Jul 2021 18:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375511; bh=dQZVRB0s0ZaI5JuJSNJrI0CmVThru6IXPILSsXFNzc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAAuZ2PTwUGOcR+k40SaXXFMYsqWUye0VL/RE6BdfO4krHVawkH3yRIpsCt8uz/cz J4KgV0d8ahJ7jDMAxBirKo8bA9kAc1h4/vTmWILF5n/8JRhYAWSB/2FUoBxM96RDAt BUNsxxUybaUYs4YTalvKiRziP+zj504WoeplSadE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aric Cyr , Krunoslav Kovac , Stylon Wang , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.12 075/242] drm/amd/display: Fix crash during MPO + ODM combine mode recalculation Date: Thu, 15 Jul 2021 20:37:17 +0200 Message-Id: <20210715182606.116649811@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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: Aric Cyr [ Upstream commit 665f28507a2a3d8d72ed9afa9a2b9b17fd43add1 ] [Why] When calculating recout width for an MPO plane on a mode that's using ODM combine, driver can calculate a negative value, resulting in a crash. [How] For negative widths, use zero such that validation will prune the configuration correctly and disallow MPO. Signed-off-by: Aric Cyr Reviewed-by: Krunoslav Kovac Acked-by: Stylon Wang Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 325e0d656d6a..749189eb20ba 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -733,6 +733,11 @@ static void calculate_recout(struct pipe_ctx *pipe_ctx) if (split_idx == split_count) { /* rightmost pipe is the remainder recout */ data->recout.width -= data->h_active * split_count - data->recout.x; + + /* ODM combine cases with MPO we can get negative widths */ + if (data->recout.width < 0) + data->recout.width = 0; + data->recout.x = 0; } else data->recout.width = data->h_active - data->recout.x; -- 2.30.2