]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
drm/amdgpu: Disable irq on device before destroying it
authorMikita Lipski <mikita.lipski@amd.com>
Thu, 15 Mar 2018 13:37:08 +0000 (09:37 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Mar 2018 04:44:03 +0000 (23:44 -0500)
Disable irq on devices before destroying them. That prevents
use-after-free memory access when unloading the driver.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index cdf7a6cde60330773db452cd7f2a621e2c328ac4..f59b017e4c61fb757f04904b6a9b3a82b1f3c280 100644 (file)
@@ -1722,6 +1722,9 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
        int i, r;
 
        amdgpu_amdkfd_device_fini(adev);
+       /* disable all interrupts */
+       amdgpu_irq_disable_all(adev);
+
        /* need to disable SMC first */
        for (i = 0; i < adev->num_ip_blocks; i++) {
                if (!adev->ip_blocks[i].status.hw)
@@ -1773,8 +1776,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
                adev->ip_blocks[i].status.hw = false;
        }
 
-       /* disable all interrupts */
-       amdgpu_irq_disable_all(adev);
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
                if (!adev->ip_blocks[i].status.sw)