nvgpu: fix resource leaks when cleaning up

In gk20a_free_channel, destroy notifier_wq and
semaphore_wq

In __nvgpu_vm_remove, destroy the update_gmmu_lock mutex

Bug 200647668

Change-Id: Icbb4e626c0fa9fa2dcf1430b3112b51829b00e4f
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2414820
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: Satish Arora <satisha@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Peter Daifuku
2020-09-16 13:50:29 -07:00
committed by mobile promotions
parent 036e000a17
commit 4f66942afa
2 changed files with 5 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
/*
* GK20A Graphics channel
*
* Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2020, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -512,6 +512,9 @@ unbind:
ch->ref_actions_put = 0;
#endif
nvgpu_cond_destroy(&ch->notifier_wq);
nvgpu_cond_destroy(&ch->semaphore_wq);
/* make sure we catch accesses of unopened channels in case
* there's non-refcounted channel pointers hanging around */
ch->g = NULL;

View File

@@ -658,6 +658,7 @@ static void __nvgpu_vm_remove(struct vm_gk20a *vm)
#endif
nvgpu_mutex_release(&vm->update_gmmu_lock);
nvgpu_mutex_destroy(&vm->update_gmmu_lock);
nvgpu_mutex_destroy(&vm->syncpt_ro_map_lock);
nvgpu_kfree(g, vm);