drm/amdgpu: add error handle to avoid out-of-bounds
authorjsg <jsg@openbsd.org>
Mon, 17 Jun 2024 07:21:57 +0000 (07:21 +0000)
committerjsg <jsg@openbsd.org>
Mon, 17 Jun 2024 07:21:57 +0000 (07:21 +0000)
From Bob Zhou
5b0a3dc3e87821acb80e841b464d335aff242691 in linux-6.6.y/6.6.34
8b2faf1a4f3b6c748c0da36cda865a226534d520 in mainline linux

sys/dev/pci/drm/amd/amdgpu/sdma_v4_0.c

index 5854767..b5d62ce 100644 (file)
@@ -2031,6 +2031,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);