diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-09-26 08:34:42 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-29 01:40:12 -0400 |
commit | 82baff9f6f3c7bb242d5378e3118763069460033 (patch) | |
tree | b83cf8267546e8b4f076006f01b5315f4c1b4efa /drivers/gpu/nvgpu | |
parent | 857222d013eb650409669791095cdebee4e97e86 (diff) |
gpu: nvgpu: do nothing on invalid tsg release
If nvgpu_ioctl_tsg_open() fails, this file has no priv data yet on
release(). In that case there is nothing to free so just return.
Jira NVGPU-967
Change-Id: I02dd1bb12a27745a3b28aaa4a943d79d82b14d2c
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1847592
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c index 8eb5f014..7ebf4291 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_tsg.c | |||
@@ -467,7 +467,14 @@ void nvgpu_ioctl_tsg_release(struct nvgpu_ref *ref) | |||
467 | int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp) | 467 | int nvgpu_ioctl_tsg_dev_release(struct inode *inode, struct file *filp) |
468 | { | 468 | { |
469 | struct tsg_private *priv = filp->private_data; | 469 | struct tsg_private *priv = filp->private_data; |
470 | struct tsg_gk20a *tsg = priv->tsg; | 470 | struct tsg_gk20a *tsg; |
471 | |||
472 | if (!priv) { | ||
473 | /* open failed, never got a tsg for this file */ | ||
474 | return 0; | ||
475 | } | ||
476 | |||
477 | tsg = priv->tsg; | ||
471 | 478 | ||
472 | nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release); | 479 | nvgpu_ref_put(&tsg->refcount, nvgpu_ioctl_tsg_release); |
473 | nvgpu_kfree(tsg->g, priv); | 480 | nvgpu_kfree(tsg->g, priv); |