]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdgpu: Limit BO list entry count to prevent resource exhaustion
authorJesse.Zhang <Jesse.Zhang@amd.com>
Thu, 12 Mar 2026 10:06:17 +0000 (18:06 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 17 Mar 2026 14:33:14 +0000 (10:33 -0400)
commit688b87d39e0aa8135105b40dc167d74b5ada5332
tree4f40db3eb533b85fcc807c9f6fb7c2956c976ab8
parentdf1f11fe142acb9312d2a9826161730f724276f7
drm/amdgpu: Limit BO list entry count to prevent resource exhaustion

Userspace can pass an arbitrary number of BO list entries via the
bo_number field. Although the previous multiplication overflow check
prevents out-of-bounds allocation, a large number of entries could still
cause excessive memory allocation (up to potentially gigabytes) and
unnecessarily long list processing times.

Introduce a hard limit of 128k entries per BO list, which is more than
sufficient for any realistic use case (e.g., a single list containing all
buffers in a large scene). This prevents memory exhaustion attacks and
ensures predictable performance.

Return -EINVAL if the requested entry count exceeds the limit

Reviewed-by: Christian König <christian.koenig@amd.com>
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jesse Zhang <jesse.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c