summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Cheng <benjamin.cheng@amd.com>2026-03-30 15:01:27 -0400
committerAlex Deucher <alexander.deucher@amd.com>2026-04-03 13:48:33 -0400
commitde2a02cc28d6d5d37db07d00a9a684c754a5fd74 (patch)
tree9bddd8172d1ada04ff88eb4160cea852d35015ca
parent66085e206431ef88ce36f53c1f53d570790ccc9e (diff)
drm/amdgpu/vce: Prevent partial address patches
In the case that only one of lo/hi is valid, the patching could result in a bad address written to in FW. Signed-off-by: Benjamin Cheng <benjamin.cheng@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index eb4a15db2ef2..efdebd9c0a1f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -680,6 +680,9 @@ static int amdgpu_vce_cs_reloc(struct amdgpu_cs_parser *p, struct amdgpu_ib *ib,
uint64_t addr;
int r;
+ if (lo >= ib->length_dw || hi >= ib->length_dw)
+ return -EINVAL;
+
if (index == 0xffffffff)
index = 0;