]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu/vce: Prevent partial address patches
authorBenjamin Cheng <benjamin.cheng@amd.com>
Mon, 30 Mar 2026 19:01:27 +0000 (15:01 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 3 Apr 2026 17:48:33 +0000 (13:48 -0400)
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
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c

index eb4a15db2ef20fbbe546c658e46af76d140c2e1d..efdebd9c0a1f3c5637fa423ddcf83a7806bcaed8 100644 (file)
@@ -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;