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 0F4441DA0E1; Mon, 23 Mar 2026 16:20:37 +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=1774282837; cv=none; b=BRQ5TtQkPPcslesljSDiOxo21XhhFpjh9YxfXVDAXK9XKUitP1PQBsx5WwhF0i1AwrQeebxB/vO1FX9JYAepbsBQOz64jDWYyj+dl5RqH/GyGI8cQK82qfpYNjELCTtU6ZHuaJK31/vG/uzxigmLlQjQv6EuWtXmpPvZ/53KZhg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282837; c=relaxed/simple; bh=wdSMikqBI/2ya+FpQjyu3X182twNH3WFfiC4kTCaBjA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TaHfvcvBXt7wPIV1i++EofvdHWRez3i5yA537drPE0CuUgwKp7C7MITCgs2CbCYOP1yTAObxdRBDO3zgLvON3fAo1tNmag2H05uwTB4eBhAv2oSYek+76qw7Mphico8QtwbSS7zpqE0OYI9ftcPvIudrIfi2eH873O3h50RoEEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XCkwhmhz; 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="XCkwhmhz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94CB8C4CEF7; Mon, 23 Mar 2026 16:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282836; bh=wdSMikqBI/2ya+FpQjyu3X182twNH3WFfiC4kTCaBjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XCkwhmhzlcOZIU8Y283gUtNcyj31pFierrmWiCHpibtjt6rM2mEHlXGa1CvBd39Sl 26o5SFi6HjZLx8BceZxSBOq+CRWYwsdUCxxwGsk4Ow2q+j/k9GKTBGtYg4HQRLGLIq cIsx94NsHM/V46pqp2m6PaMu2I1dKobcDlhioFag= 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 304/481] drm/amdgpu/mmhub2.3: add bounds checking for cid Date: Mon, 23 Mar 2026 14:44:46 +0100 Message-ID: <20260323134532.518777656@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 a54403a534972af5d9ba5aaa3bb6ead612500ec6 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 89cd90375c19fb45138990b70e9f4ba4806f05c4) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c @@ -94,7 +94,8 @@ mmhub_v2_3_print_l2_protection_fault_sta case IP_VERSION(2, 3, 0): case IP_VERSION(2, 4, 0): case IP_VERSION(2, 4, 1): - mmhub_cid = mmhub_client_ids_vangogh[cid][rw]; + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_vangogh) ? + mmhub_client_ids_vangogh[cid][rw] : NULL; break; default: mmhub_cid = NULL;