]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 May 2026 15:16:30 +0000 (17:16 +0200)
commit de2a02cc28d6d5d37db07d00a9a684c754a5fd74 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c

index a7d8f1ce6ac2d7474acea50e93a761e871a032d3..97cf2f4c58a6398a6a290bd9551bbdac0cbcd306 100644 (file)
@@ -698,6 +698,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;