[PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure.

Zhu, Rex Rex.Zhu at amd.com
Thu Mar 22 03:34:09 UTC 2018


 kfree(adev->irq.client[i].sources);
+adev->irq.client[i].sources = NULL;

Set adev->irq.client[i].sources to NULL in amdgpu_irq_fini also can fix NULL ptr in amdgpu_irq_disable_all..

But I didn't check why amdgpu_device_fini was called twice.
 
This patch looks good.


Best Regards
Rex

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf Of Andrey Grodzovsky
Sent: Thursday, March 22, 2018 2:23 AM
To: amd-gfx at lists.freedesktop.org
Cc: Grodzovsky, Andrey
Subject: [PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure.

Problem:
When unloading due to failure amdgpu_device_fini was called twice which was leading to NULL ptr in amdgpu_irq_disable_all.

Fix:
Call amdgpu_device_fini only once from amdgpu_driver_unload_kms.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 60e577c..c51be05 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2023,7 +2023,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,
 		}
 		dev_err(adev->dev, "amdgpu_device_ip_init failed\n");
 		amdgpu_vf_error_put(adev, AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL, 0, 0);
-		amdgpu_device_ip_fini(adev);
 		goto failed;
 	}
 
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list