From bac38f52cc6f2ddc435a748dd9c85f3c5d88153f Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Mon, 3 Sep 2018 10:51:02 +0530 Subject: gpu: nvgpu: protect clk_arb init with mutex. g->clk_arb is currently initialized as a part of gk20a_finalize_poweron(). Any subsequent call to gk20a_finalize_poweron reinitializes the clk_arb and leading to memory leaks. This is resolved by protecting the g->clk_arb initialization with a mutex clk_arb_enable_lock in struct gk20a. We skip initializing the g->clk_arb if its not NULL. Bug 2061372 Change-Id: I59158e0a5e4c827fdbd6d9ea2d04c78d0986347a Signed-off-by: Debarshi Dutta Reviewed-on: https://git-master.nvidia.com/r/1811650 Reviewed-by: Deepak Nibade GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gp106/clk_arb_gp106.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/gpu/nvgpu/gp106') diff --git a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c index 860344d0..001f2bfc 100644 --- a/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c +++ b/drivers/gpu/nvgpu/gp106/clk_arb_gp106.c @@ -121,6 +121,10 @@ int gp106_init_clk_arbiter(struct gk20a *g) clk_arb_dbg(g, " "); + if (g->clk_arb != NULL) { + return 0; + } + arb = nvgpu_kzalloc(g, sizeof(struct nvgpu_clk_arb)); if (!arb) return -ENOMEM; -- cgit v1.2.2