summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-10-31 03:53:45 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-02 08:11:11 -0400
commitd256b2aa5246af46ae6e3a938ba0f974254a5910 (patch)
treebf0cc43b3d5ec28821b56bf6d28f369183dd271d /drivers/gpu/nvgpu/gk20a/gr_gk20a.c
parent0aa4cea63b906401df1bece74cef4a566054cf59 (diff)
gpu: nvgpu: fix mutex leak on fecs_mutex
In gk20a_gr_reset(), we acquire g->gr.fecs_mutex and call a bunch of APIs But in case any of these APIs fail, we don't release the mutex and just return the error leaking the mutex So the next attempt to acquire g->gr.fecs_mutex results in a deadlock Fix this by releasing the mutex before returning error Bug 2015370 Change-Id: I9a0214ff53515f819c6566c7d44d1898027416e1 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1589062 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
index e30c595e..2a20c2d9 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c
@@ -5057,16 +5057,22 @@ int gk20a_gr_reset(struct gk20a *g)
5057 nvgpu_mutex_acquire(&g->gr.fecs_mutex); 5057 nvgpu_mutex_acquire(&g->gr.fecs_mutex);
5058 5058
5059 err = gk20a_enable_gr_hw(g); 5059 err = gk20a_enable_gr_hw(g);
5060 if (err) 5060 if (err) {
5061 nvgpu_mutex_release(&g->gr.fecs_mutex);
5061 return err; 5062 return err;
5063 }
5062 5064
5063 err = gk20a_init_gr_setup_hw(g); 5065 err = gk20a_init_gr_setup_hw(g);
5064 if (err) 5066 if (err) {
5067 nvgpu_mutex_release(&g->gr.fecs_mutex);
5065 return err; 5068 return err;
5069 }
5066 5070
5067 err = gr_gk20a_init_ctxsw(g); 5071 err = gr_gk20a_init_ctxsw(g);
5068 if (err) 5072 if (err) {
5073 nvgpu_mutex_release(&g->gr.fecs_mutex);
5069 return err; 5074 return err;
5075 }
5070 5076
5071 nvgpu_mutex_release(&g->gr.fecs_mutex); 5077 nvgpu_mutex_release(&g->gr.fecs_mutex);
5072 5078