]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/amdgpu: validate GEM_CREATE domain combinations
authorCandice Li <candice.li@amd.com>
Mon, 27 Jul 2026 03:51:37 +0000 (11:51 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Aug 2026 14:20:58 +0000 (10:20 -0400)
commit5e9d136ad74df4edec67e502ce267597064d8f86
treed6f996d6c3547ef8abe413acde504b2c915fe5c2
parent931cd1d1baeae68e8eb2c23bc1f3d8934dca6241
drm/amdgpu: validate GEM_CREATE domain combinations

AMDGPU_GEM_CREATE checked domain bits against AMDGPU_GEM_DOMAIN_MASK,
but did not validate domain combinations. Userspace could combine
CPU|GTT|VRAM with DOORBELL, GDS, GWS, or OA, making
amdgpu_bo_placement_from_domain() exceed AMDGPU_BO_MAX_PLACEMENTS and
hit BUG_ON().

Allow combinations only within CPU/GTT/VRAM, and require non-CPU/GTT/
VRAM domains to be specified one at a time. Return -EINVAL for invalid
combinations in amdgpu_gem_create_ioctl().

v2: Rename helper from amdgpu_gem_domain_valid() to
    amdgpu_gem_are_domains_valid() (Christian)

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit db39852d0c39843cb02048dfb47e4b8c703e9080)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c