gpu: nvgpu: fix erroneous gk20a_put() call

With a recent rework we moved gk20a_get() call to nvgpu_ioctl_tsg_open(),
but corresponding gk20a_put() call remained in gk20a_tsg_release()

So if a TSG is opened and released from within kernel with APIs
gk20a_tsg_open()/gk20a_tsg_release() we mistakenly drop extra refcount
through gk20a_put()

Fix this by moving gk20a_put() call to nvgpu_ioctl_tsg_release() which
balances gk20a_get() call in nvgpu_ioctl_tsg_open()

Bug 200374011

Change-Id: Id0cec0426e6231309dc530ab5c934dacaba9f8da
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1630969
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-03 06:28:47 -08:00
committed by mobile promotions
parent c7b7dbe39a
commit e0aca109b1
2 changed files with 1 additions and 1 deletions

View File

@@ -359,6 +359,7 @@ void nvgpu_ioctl_tsg_release(struct nvgpu_ref *ref)
gk20a_sched_ctrl_tsg_removed(g, tsg);
gk20a_tsg_release(ref);
gk20a_put(g);
}
int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp)

View File

@@ -347,7 +347,6 @@ void gk20a_tsg_release(struct nvgpu_ref *ref)
tsg->runlist_id = ~0;
gk20a_dbg(gpu_dbg_fn, "tsg released %d\n", tsg->tsgid);
gk20a_put(g);
}
struct tsg_gk20a *tsg_gk20a_from_ch(struct channel_gk20a *ch)