From 4f66942afaaae2fcfedec2bf351664ac3b656238 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Wed, 16 Sep 2020 13:50:29 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2414820 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Shashank Singh Reviewed-by: Alex Waterman Reviewed-by: Satish Arora Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/fifo/channel.c | 5 ++++- drivers/gpu/nvgpu/common/mm/vm.c | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/fifo/channel.c b/drivers/gpu/nvgpu/common/fifo/channel.c index 0f4fe850..7179d46e 100644 --- a/drivers/gpu/nvgpu/common/fifo/channel.c +++ b/drivers/gpu/nvgpu/common/fifo/channel.c @@ -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; diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index e6ca38c8..2464a3bf 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c @@ -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); -- cgit v1.2.2