gpu: nvgpu: Add ref counting to channels
authorAlex Waterman <alexw@nvidia.com>
Thu, 13 Oct 2016 17:03:59 +0000 (10:03 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 6 Dec 2016 10:53:40 +0000 (02:53 -0800)
commitba5e6cc875971f0559d05f44035d27fc067e446f
tree30f1f859742ca9a1dc25483c7308ada23904ff75
parentc3e48f8bcbd6163ea8ee12b73b0dd6926551030d
gpu: nvgpu: Add ref counting to channels

Make sure that the VM owned by a channel lives for at least
as long as that channel does. If the channel's VM is cleaned
up before the channel then use-after-free bugs can occur.

It seems like the gk20a_vm_get() was simply missing from the
bind channel. This patch adds it. The corresponding
gk20a_vm_put() happens during channel close.

Bug: 31680980
NvBug 1825464

Change-Id: If745ad4c1454386ddad9a83ff22ccd9ba2a72168
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1265358
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vinayak Pane <vpane@nvidia.com>
drivers/gpu/nvgpu/gk20a/mm_gk20a.c