[PATCH V2] drm/amdgpu: Disable irq on device before destroying it

Christian König ckoenig.leichtzumerken at gmail.com
Thu Mar 15 14:54:53 UTC 2018


Am 15.03.2018 um 15:50 schrieb mikita.lipski at amd.com:
> From: Mikita Lipski <mikita.lipski at amd.com>
>
> 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 at amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

Acked-by: Christian König <christian.koenig at amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
>   1 file 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 b4911911..0b798cb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -1432,6 +1432,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)
> @@ -1482,8 +1485,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)



More information about the amd-gfx mailing list