drm/amdgpu: fix gart.bo pin_count leak
authorjsg <jsg@openbsd.org>
Sun, 17 Oct 2021 10:59:45 +0000 (10:59 +0000)
committerjsg <jsg@openbsd.org>
Sun, 17 Oct 2021 10:59:45 +0000 (10:59 +0000)
From Leslie Shi
621ddffb70db824eabd63d18ac635180fe9500f9 in linux 5.10.y/5.10.74
66805763a97f8f7bdf742fc0851d85c02ed9411f in mainline linux

sys/dev/pci/drm/amd/amdgpu/gmc_v10_0.c
sys/dev/pci/drm/amd/amdgpu/gmc_v9_0.c

index 58ad3a5..de4be5d 100644 (file)
@@ -1018,6 +1018,8 @@ static int gmc_v10_0_hw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       gmc_v10_0_gart_disable(adev);
+
        if (amdgpu_sriov_vf(adev)) {
                /* full access mode, so don't touch any GMC register */
                DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
@@ -1026,7 +1028,6 @@ static int gmc_v10_0_hw_fini(void *handle)
 
        amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
        amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
-       gmc_v10_0_gart_disable(adev);
 
        return 0;
 }
index e9195ba..e130e8d 100644 (file)
@@ -1677,6 +1677,8 @@ static int gmc_v9_0_hw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
+       gmc_v9_0_gart_disable(adev);
+
        if (amdgpu_sriov_vf(adev)) {
                /* full access mode, so don't touch any GMC register */
                DRM_DEBUG("For SRIOV client, shouldn't do anything.\n");
@@ -1685,7 +1687,6 @@ static int gmc_v9_0_hw_fini(void *handle)
 
        amdgpu_irq_put(adev, &adev->gmc.ecc_irq, 0);
        amdgpu_irq_put(adev, &adev->gmc.vm_fault, 0);
-       gmc_v9_0_gart_disable(adev);
 
        return 0;
 }