]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amdgpu: add error handle to avoid out-of-bounds
authorBob Zhou <bob.zhou@amd.com>
Tue, 23 Apr 2024 08:58:11 +0000 (16:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:32:32 +0000 (13:32 +0200)
commit 8b2faf1a4f3b6c748c0da36cda865a226534d520 upstream.

if the sdma_v4_0_irq_id_to_seq return -EINVAL, the process should
be stop to avoid out-of-bounds read, so directly return -EINVAL.

Signed-off-by: Bob Zhou <bob.zhou@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

index dbcaef3f35da99981d57ad05ae9d11b1923becff..c54834ed8751e10a9c5372d855f414cd47133412 100644 (file)
@@ -2073,6 +2073,9 @@ static int sdma_v4_0_process_trap_irq(struct amdgpu_device *adev,
 
        DRM_DEBUG("IH: SDMA trap\n");
        instance = sdma_v4_0_irq_id_to_seq(entry->client_id);
+       if (instance < 0)
+               return instance;
+
        switch (entry->ring_id) {
        case 0:
                amdgpu_fence_process(&adev->sdma.instance[instance].ring);