diff options
author | Mikita Lipski <mikita.lipski@amd.com> | 2018-03-15 09:37:08 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-03-21 00:44:03 -0400 |
commit | 088e7c16170645f1e2298ec6e0029079ef603635 (patch) | |
tree | d99fe9c189125a528fbdece5eda5f755402c37b4 /drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |
parent | ff97cba8c1b24f6017e16ca6facca3c3f32d2c00 (diff) |
drm/amdgpu: Disable irq on device before destroying it
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index cdf7a6cde603..f59b017e4c61 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -1722,6 +1722,9 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev) | |||
1722 | int i, r; | 1722 | int i, r; |
1723 | 1723 | ||
1724 | amdgpu_amdkfd_device_fini(adev); | 1724 | amdgpu_amdkfd_device_fini(adev); |
1725 | /* disable all interrupts */ | ||
1726 | amdgpu_irq_disable_all(adev); | ||
1727 | |||
1725 | /* need to disable SMC first */ | 1728 | /* need to disable SMC first */ |
1726 | for (i = 0; i < adev->num_ip_blocks; i++) { | 1729 | for (i = 0; i < adev->num_ip_blocks; i++) { |
1727 | if (!adev->ip_blocks[i].status.hw) | 1730 | if (!adev->ip_blocks[i].status.hw) |
@@ -1773,8 +1776,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev) | |||
1773 | adev->ip_blocks[i].status.hw = false; | 1776 | adev->ip_blocks[i].status.hw = false; |
1774 | } | 1777 | } |
1775 | 1778 | ||
1776 | /* disable all interrupts */ | ||
1777 | amdgpu_irq_disable_all(adev); | ||
1778 | 1779 | ||
1779 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { | 1780 | for (i = adev->num_ip_blocks - 1; i >= 0; i--) { |
1780 | if (!adev->ip_blocks[i].status.sw) | 1781 | if (!adev->ip_blocks[i].status.sw) |