Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2405443lqp; Sun, 24 Mar 2024 18:10:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWsO4xl0iAle3/INKAjTeIOl99wewvYrMC2ymNgpU3KyWG2K1kUNSdMVJ67vcMwYWRW55mQREDVks01hOGoEue5ddnc0LogfKXX10EXyA== X-Google-Smtp-Source: AGHT+IFq8Uy9A9ZTmrAH3NuHxk3QAo5XV9MB9QUR+16UZ8l09olzxFw+631nfFxw8rFlOao/Y7Ru X-Received: by 2002:a05:6402:5211:b0:56c:1696:58a8 with SMTP id s17-20020a056402521100b0056c169658a8mr323185edd.0.1711329013436; Sun, 24 Mar 2024 18:10:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711329013; cv=pass; d=google.com; s=arc-20160816; b=mFfHkga9hip4hBqdoZsBf0IC8FNEXeRgFZVU6GW/ryyC9e8+bPxX+bQMiKVralEUes y36kG7V/SdjE+b1aFEk3hP6VwUBcBCZ44CBzh7N6XRDkpPglRXHGXWu91GJPl4B4UHIx RdtvhzZcuTzoCgU4CM3JdgiwXlqoyBeU5taJ3cyeV07a7HH9XXK1sUYBSN1Y87nOadQe dQ7m1LYFxdkFAtXhdW0Iuh7kppQiapDRv1x8o115jdct23fZ8bp8SmcZZl7/AzYbKypy s0IPGYw7s2wgA2lgSYTP/69Z47TOm+CmER+x8EGSg6cd8H+cqheBCG19JpruxTGazdHa 0wtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=k9T5b8glMLfdvQ6MVZjr+6IcKPUsZ7PcMsf8GBpEr4s=; fh=hRM5fyWfo1vHX3j6kaWfWDLzhMJaiADNQ30Hhducfvo=; b=GomIeHZRQ7rtbSSWAFYTieExVkKdxmFsMokIv2WYPmrjy+EXd69LtZ5mW5mtYLgor9 b7lM/ibpVwkTu+bWivKirK3oMOhxXalH9KkdxT7guQMC9Nzpa53sITwccIDEkZ7ZQZ9C SuLmXPEm8/jTSTlWtLEGPpoBf8xSwp6+EWn2lTmM/5qTQlEvRLqqHXVZxBYQLz0DBeD7 1YGIEoT0LiLcnw+einIdq1/yrLR62CaNBld+TTOIVsT3dzxj2eZd9XBfrazvsCOfORpe YBKKOugl5vjgw0nGB58xpH9Wx8498TBGS125MQbf7n0wDB7PFG9q9YClGTD3nkkZRLlP 8l2g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JV7VEQ4f; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id j18-20020a05640211d200b0056c156fd892si213392edw.301.2024.03.24.18.10.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:10:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JV7VEQ4f; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113589-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113589-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 2F9AF1F23FC3 for ; Mon, 25 Mar 2024 01:10:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 870331CBDE9; Sun, 24 Mar 2024 22:46:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JV7VEQ4f" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B8C71CB68D; Sun, 24 Mar 2024 22:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320392; cv=none; b=HPzbafQgaGzAIdyQU3mx1rJDTC3zeqh+aSkXkywPOG6wffA+wNS6DHQeu5d2RKiOJYYJq7/sr5y4zSn0z9JcgFGuO/cv7rY2zcwczyHmB/ztc+JIu6UQzDrQ3zSv+4P0a47xiCcyoeTf+YS/2omcac96CqhAdmoRh4AWkN1jXW8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320392; c=relaxed/simple; bh=+gfGD22mjnzhNRULgZth3y7IpdDh67/7ZzicS4dW69c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NHGGAXiHEBXo6VYyZrX8yEtP4Ay3yfWMXkijOrYoul5XdAEokJcvSFoOzx41CZgssDcmEF6C+WE45/zbU2ioQhKzadJTwnPgln8vnc6C2ofhNcOSQ0xmMgMBEnhwqTQn2Ol927M5KQza4hZN0fOqVpcVdjt30EOOtrlHtZHE3s0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JV7VEQ4f; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88157C43390; Sun, 24 Mar 2024 22:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320392; bh=+gfGD22mjnzhNRULgZth3y7IpdDh67/7ZzicS4dW69c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JV7VEQ4fnjL0YoVJZzQfi68t+A/xsuRO5B995SD+bsW/g8mh3SVeLyD/2yRhO6B6z txMsKKqYzqiGv+z1/7oKLN+4BF/Aaq1Pj94tTp6BHeJyY1v7GYJU8urbdC1s1l2vfF 3SJ7rKEOhdnJZgJ3cxFp+SB7a5LyD5cCtXpzv1FRfbJde8nrbworRRVPA2duQCziFW 0VtqCKRP7uFoW+gA5ZUXHkL/tPh1r2/CLuZhO+W4pupNi8nNgKfwLvNYVBsFjUHM6f JfaiU7XLDe1HowvqvTpkNmyTE4mxzL0qJtQ8YMW0Z4Vxk1TFJzQp7jS60IMOSWLslt lDKypHAMcIRUw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lang Yu , Yifan Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 6.8 698/715] drm/amdgpu: fix mmhub client id out-of-bounds access Date: Sun, 24 Mar 2024 18:34:37 -0400 Message-ID: <20240324223455.1342824-699-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Lang Yu [ Upstream commit 6540ff6482c1a5a6890ae44b23d0852ba1986d9e ] Properly handle cid 0x140. Fixes: aba2be41470a ("drm/amdgpu: add mmhub 3.3.0 support") Signed-off-by: Lang Yu Reviewed-by: Yifan Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c index b3961968c10c4..238ea40c24500 100644 --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_3.c @@ -99,16 +99,15 @@ mmhub_v3_3_print_l2_protection_fault_status(struct amdgpu_device *adev, switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) { case IP_VERSION(3, 3, 0): case IP_VERSION(3, 3, 1): - mmhub_cid = mmhub_client_ids_v3_3[cid][rw]; + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_v3_3) ? + mmhub_client_ids_v3_3[cid][rw] : + cid == 0x140 ? "UMSCH" : NULL; break; default: mmhub_cid = NULL; break; } - if (!mmhub_cid && cid == 0x140) - mmhub_cid = "UMSCH"; - dev_err(adev->dev, "\t Faulty UTCL2 client ID: %s (0x%x)\n", mmhub_cid ? mmhub_cid : "unknown", cid); dev_err(adev->dev, "\t MORE_FAULTS: 0x%lx\n", -- 2.43.0