[4/4] amdkfd: Fix possible dangling ptr in kfd_dbgmgr_destroy()

Submitted by Edward O'Callaghan on Sept. 3, 2016, 2:49 a.m.

Details

Message ID 1472870947-11300-5-git-send-email-funfunctor@folklore1984.net
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Edward O'Callaghan Sept. 3, 2016, 2:49 a.m.
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
---
 drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
index 56d6763..8a26d5a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
@@ -58,6 +58,7 @@  void kfd_dbgmgr_destroy(struct kfd_dbgmgr *pmgr)
 	if (pmgr != NULL) {
 		kfd_dbgmgr_uninitialize(pmgr);
 		kfree(pmgr);
+		pmgr = NULL;
 	}
 }
 

Comments

On Sat, Sep 3, 2016 at 5:49 AM, Edward O'Callaghan
<funfunctor@folklore1984.net> wrote:
> Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c b/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
> index 56d6763..8a26d5a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_dbgmgr.c
> @@ -58,6 +58,7 @@ void kfd_dbgmgr_destroy(struct kfd_dbgmgr *pmgr)
>         if (pmgr != NULL) {
>                 kfd_dbgmgr_uninitialize(pmgr);
>                 kfree(pmgr);
> +               pmgr = NULL;
pmgr is passed as argument to function. There is no point of setting it to NULL.

Oded

>         }
>  }
>
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx