From mboxrd@z Thu Jan 1 00:00:00 1970 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 B34673A960E; Mon, 23 Mar 2026 16:20:47 +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=1774282847; cv=none; b=R5bJk/xV41O9uw7nuOg6ILSCJKrryvj/e1gO7CIWS4+oZDbGXZfkc1r8tA8z6Nw5iBG9GR2ajrf/HqQD/sr8ov9jc/EaUtrFzfjbA8UppirO41S3owhbXwQkXfgA8X0LEqxkQ6KuDMyZFq3GPBEbI/QMivoJZFGFi6xDxoopFMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282847; c=relaxed/simple; bh=CiFLusp/jfIQ/UqKKUACvEneCZZrNd6vXELTv7ApVa8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f1WLc/085HKCNd6faVO7ibrVzPKwNkvf6+CohZXX9DqHfq8P+rcHbQMPtFtNqji13oQTWuSIC4EWGP6vw1ZEUPYP6JnTFRf0GvFgNATyzOC+3SMV96Wh5ShU4gfhBacsXsW0aYfWlJxScdzMnlBH1EtPHkVkHlz1fCBKCLDFEaQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zwF9qbWb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="zwF9qbWb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4175BC2BCB6; Mon, 23 Mar 2026 16:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282847; bh=CiFLusp/jfIQ/UqKKUACvEneCZZrNd6vXELTv7ApVa8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zwF9qbWby3GrX80goIemfP+uKZ6YvcKPj2oLEyeJwjJWiYE29O3rLlg2FgkpNet8i YhsG7kBPVaqaj68z8X/zsxY9TI71o14aaU+KmXod371eOcQiop3VDzoaHtaE8iTds+ LPBBKsoZI7WzdUm0v/RJ+5Pirl6I+GSxwV60t7W0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Benjamin Cheng , Alex Deucher Subject: [PATCH 6.1 307/481] drm/amdgpu/mmhub3.0: add bounds checking for cid Date: Mon, 23 Mar 2026 14:44:49 +0100 Message-ID: <20260323134532.591180511@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Deucher commit cdb82ecbeccb55fae75a3c956b605f7801a30db1 upstream. The value should never exceed the array size as those are the only values the hardware is expected to return, but add checks anyway. Reviewed-by: Benjamin Cheng Signed-off-by: Alex Deucher (cherry picked from commit f14f27bbe2a3ed7af32d5f6eaf3f417139f45253) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c @@ -110,7 +110,8 @@ mmhub_v3_0_print_l2_protection_fault_sta switch (adev->ip_versions[MMHUB_HWIP][0]) { case IP_VERSION(3, 0, 0): case IP_VERSION(3, 0, 1): - mmhub_cid = mmhub_client_ids_v3_0_0[cid][rw]; + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_v3_0_0) ? + mmhub_client_ids_v3_0_0[cid][rw] : NULL; break; default: mmhub_cid = NULL;