gpu: nvgpu: fix TSG leak from CE code

In gk20a_ce_delete_gpu_context(), we unbind the channel from TSG and
close the channel. But we do not drop the TSG refcount leaking
the TSG reference

Fix this by explicitly dropping TSG refcount

Also, do not explicitly unbind the channel from TSG
gk20a_channel_close() will internally unbind the channel from TSG

Bug 200374011

Change-Id: Ie4aa32f1d0bff4231f41aa2b33743cdc63e967c7
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1629972
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2018-01-02 02:04:06 -08:00
committed by mobile promotions
parent 292e4a0c6d
commit 5ad1c28b5f

View File

@@ -153,13 +153,12 @@ static void gk20a_ce_delete_gpu_context(struct gk20a_gpu_ctx *ce_ctx)
nvgpu_dma_unmap_free(ce_ctx->vm, &ce_ctx->cmd_buf_mem);
}
/* unbind tsg */
if (ce_ctx->tsg && ce_ctx->ch)
gk20a_tsg_unbind_channel(ce_ctx->ch);
/* free the channel */
if (ce_ctx->ch)
gk20a_channel_close(ce_ctx->ch);
/*
* free the channel
* gk20a_channel_close() will also unbind the channel from TSG
*/
gk20a_channel_close(ce_ctx->ch);
nvgpu_ref_put(&ce_ctx->tsg->refcount, gk20a_tsg_release);
/* housekeeping on app */
if (list->prev && list->next)