Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp655042pxv; Thu, 15 Jul 2021 12:36:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/EYVIO6vN5+VyATNQcaFpzH6Suay16GZ8TxKZeE4bE2FnGRqDxGeny3b1kIuUu4Qk47is X-Received: by 2002:a50:ee15:: with SMTP id g21mr9206954eds.334.1626377775048; Thu, 15 Jul 2021 12:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377775; cv=none; d=google.com; s=arc-20160816; b=UXg3rQylICeptxvhdMTILbUW9Zr6LsPFSjcAt82FOr5gO3UJF11gYrvg0QMj37a77e rItrvXW4N/U4NldyI1r1iguynP95DhgOjP16VU7BQdbfE8Up9ZNH5YW36Tmo6ME7gFNU TldsxJb8CpYctomwsQlNpQg341GL4FM5KoEG9BXj0aXr3pkUeiPh7DcHJvVEALPnM+QR QILt9Jcftyl/z7oqZKOcw6F5YUCEl3ruVisC5itAdJtBulrBvuKxYwY6qdIwj+T84mnq cAVsq7aDvU7srcjh+3ZUvroNWYfLQwZr/V9DaUftqn6NJmOGcQ9m+WTYC452EGg8afCU hYJQ== 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=osn9KY4PddP6wMc4A+uhQxx9RL3i2rd6hKwVZ8QjNzI=; b=pm1v0dUf0y/vRaUVQnWKL0p00DsYsJ2xae5t1gu8Q2TS+HMIfCmRSVUtkPFXcF1Es4 aRuYUW9ZU4bNe3QTVnSyW6o6W6BJ3JPFuV/mrInrhmZ/l/Zg+kB5aoXCZRiJH6DDltrw WKYCZuhfwGqkbSR3q2SoCdLsEiHSmSj2ytNqDJ3gmJepjTPyMyWk03AGLkF2vApEwgf1 7TzxNCAZMJVZYa4TemFKF3YGREl76czhnpeWGztOUIkwnAAPyyGlf2GSE9dfWt5/V4Cd aZgr+POTri5757LmRS62NRPJe4jk6a/iFNumsQ9x38AMze/Z7gfE00g41wBL8LTjzfv1 CdSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F2QzWaij; 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 s11si8398585edd.46.2021.07.15.12.35.51; Thu, 15 Jul 2021 12:36:15 -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=F2QzWaij; 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 S1343738AbhGOTb6 (ORCPT + 99 others); Thu, 15 Jul 2021 15:31:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:46400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243829AbhGOTKI (ORCPT ); Thu, 15 Jul 2021 15:10:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5EA8B613E0; Thu, 15 Jul 2021 19:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626376007; bh=ZtR6uqjh9r46IYe5YwSQZB+ViQIJ6CXVhQ+5mOkRKOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F2QzWaijJEYeM1RzYiayf2HlTqvJMKFPGekwzTYVMlmdCBqYSVHn0kxuDOOJ4BdYX M0+3Ayu/WVDbv9l+y7c+Uf8RJBo9AxpqpvPBy+uy5kcUIhHlktgYLf88nS3O7LuEzD 1LqIgd4mhztt0Jkf6W0LtqWYAXDb50VtL3BaLv34= 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.13 088/266] drm/amd/display: Fix crash during MPO + ODM combine mode recalculation Date: Thu, 15 Jul 2021 20:37:23 +0200 Message-Id: <20210715182629.733034609@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 78278a10d899..3b1068a09095 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -776,6 +776,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