]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: reject oversized IBs with per-ring packet limits
authorCandice Li <candice.li@amd.com>
Thu, 30 Jul 2026 03:28:10 +0000 (11:28 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Aug 2026 18:32:33 +0000 (14:32 -0400)
commitfd37f9dd5b5ab70a46fa7bc76623c0528d602b27
tree072ae1b6bb885a1e3a43d0a657b2b7acd17c0c4b
parentb77a725e50c87c091f51affc8e46710badea0d49
drm/amdgpu: reject oversized IBs with per-ring packet limits

On GFX rings, amdgpu_cs_p2_ib() passed user-supplied ib_bytes through
to ib->length_dw without a limit, while ring_emit_ib() encodes length
into packet fields. Oversized values can corrupt adjacent control bits
and destabilize command submission.

Add a per-ring IB packet size limit helper and reject command
submissions exceeding the corresponding dword limit before IB
allocation. Use the documented 20-bit limit for GFX/compute/SDMA/VPE,
and apply the MM fallback limit for other ring types.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 7f48fa2cf62e3fa6c9c3870aa74988f773247e52)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c