]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdgpu: validate doorbell_offset in user queue creation
authorJunrui Luo <moonafterrain@outlook.com>
Tue, 24 Mar 2026 09:39:02 +0000 (17:39 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 30 Mar 2026 18:30:55 +0000 (14:30 -0400)
commitde1ef4ffd70e1d15f0bf584fd22b1f28cbd5e2ec
tree94d9fc7e1a5f8d38f42b0322f9749b36000e34fc
parenta51973c5dff8a0f01cc7d1b2007306ea0004fa16
drm/amdgpu: validate doorbell_offset in user queue creation

amdgpu_userq_get_doorbell_index() passes the user-provided
doorbell_offset to amdgpu_doorbell_index_on_bar() without bounds
checking. An arbitrarily large doorbell_offset can cause the
calculated doorbell index to fall outside the allocated doorbell BO,
potentially corrupting kernel doorbell space.

Validate that doorbell_offset falls within the doorbell BO before
computing the BAR index, using u64 arithmetic to prevent overflow.

Fixes: f09c1e6077ab ("drm/amdgpu: generate doorbell index for userqueue")
Reported-by: Yuhao Jiang <danisjiang@gmail.com>
Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c