From 4531a27adcc5629d1e246af5b0a5ca378daca9d1 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 15 May 2015 17:59:59 +0530 Subject: gpu: nvgpu: fix channel leak with immediate close If a GPU channel is closed immediately after opening without performing any operation on it, we leak that channel e.g. below command leaks a channel echo > /dev/nvhost-gpu Fix this leak by releasing the channel before returning Change-Id: I2598e3cabec6996cb1cf8066a1e6d7d5864ae02b Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/743235 (cherry picked from commit 428771509b4431ebe88e38061b495cabc5192327) Reviewed-on: http://git-master/r/744279 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 5691a7cd..f311a91a 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -577,7 +577,7 @@ void gk20a_free_channel(struct channel_gk20a *ch, bool finish) mutex_unlock(&f->deferred_reset_mutex); if (!ch->bound) - return; + goto release; if (!gk20a_channel_as_bound(ch)) goto unbind; @@ -652,6 +652,7 @@ unbind: mutex_unlock(&ch->dbg_s_lock); +release: /* ALWAYS last */ release_used_channel(f, ch); } -- cgit v1.2.2