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 0D0BA3AE19E; Mon, 23 Mar 2026 13:54:10 +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=1774274051; cv=none; b=V5kgX+fmqbtrKrbR3W7ZzD6D6Mg+bOJ130orgYSzRWV5exl//2RRa4qH5Oa00j+MgL/qGfDEFKRGfSvYhbsTIkl3yGDKntFLOZ1dCm9sSo6PV5iemh/QRFTF7pFnrMxkrSRUzgnmRdIVtvomvMTWpHTW7BvRFE+9J1rvpW9sC44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274051; c=relaxed/simple; bh=kvw3nYAUkHX9gRol9GVLvnY0ubD3IKVQ52wp46mElxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IaLnSuoJYI+n3xDW7geyO7ueY/jR1NcFbhWFldgMBa4iJiNvrzZjIwtlvxC30cJgwH86dt/28gUlH8y7Tc35Hrt159Y4yh8JGzf2zx5AoejtsjMfxzu4hFK3kgzJblybVKZL2Y1zI6WcjuPMdruANNkHBVH+0CK2ora96yj8sRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G6VNu7Yn; 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="G6VNu7Yn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F3EBC4CEF7; Mon, 23 Mar 2026 13:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274050; bh=kvw3nYAUkHX9gRol9GVLvnY0ubD3IKVQ52wp46mElxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6VNu7YnekdMDBRnEYDtYW/pOIJJjWuZeruMiAVtqGHLM71I69NLE2rN/E8MjUnHo 7mPp/zF8q0gPzYZJy4RhIrUUCzvUSivR9RIQQm2eBwfeCpi3hgmRQvc2JLiOyUQWvE kwBcFyx3F51S4SQyoCXdpYvAMfl5i+BEnD3W9/y0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Benjamin Cheng , Alex Deucher Subject: [PATCH 6.19 076/220] drm/amdgpu/mmhub3.0.1: add bounds checking for cid Date: Mon, 23 Mar 2026 14:44:13 +0100 Message-ID: <20260323134506.997203022@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134504.575022936@linuxfoundation.org> References: <20260323134504.575022936@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Deucher commit 5d4e88bcfef29569a1db224ef15e28c603666c6d 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 5f76083183363c4528a4aaa593f5d38c28fe7d7b) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0_1.c @@ -117,7 +117,8 @@ mmhub_v3_0_1_print_l2_protection_fault_s switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) { case IP_VERSION(3, 0, 1): - mmhub_cid = mmhub_client_ids_v3_0_1[cid][rw]; + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_v3_0_1) ? + mmhub_client_ids_v3_0_1[cid][rw] : NULL; break; default: mmhub_cid = NULL;