All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure.
@ 2018-03-21 18:22 Andrey Grodzovsky
       [not found] ` <1521656572-19414-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Grodzovsky @ 2018-03-21 18:22 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Andrey Grodzovsky

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@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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure.
       [not found] ` <1521656572-19414-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2018-03-21 18:54   ` Alex Deucher
  2018-03-22  3:34   ` Zhu, Rex
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2018-03-21 18:54 UTC (permalink / raw)
  To: Andrey Grodzovsky; +Cc: amd-gfx list

On Wed, Mar 21, 2018 at 2:22 PM, Andrey Grodzovsky
<andrey.grodzovsky@amd.com> wrote:
> 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@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure.
       [not found] ` <1521656572-19414-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  2018-03-21 18:54   ` Alex Deucher
@ 2018-03-22  3:34   ` Zhu, Rex
  1 sibling, 0 replies; 3+ messages in thread
From: Zhu, Rex @ 2018-03-22  3:34 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Grodzovsky, Andrey

 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@lists.freedesktop.org] On Behalf Of Andrey Grodzovsky
Sent: Thursday, March 22, 2018 2:23 AM
To: amd-gfx@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@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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-22  3:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21 18:22 [PATCH] drm/amdgpu: Fix NULL ptr on driver unload due to init failure Andrey Grodzovsky
     [not found] ` <1521656572-19414-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2018-03-21 18:54   ` Alex Deucher
2018-03-22  3:34   ` Zhu, Rex

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.