diff options
author | Vince Hsu <vinceh@nvidia.com> | 2018-07-13 04:11:37 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-07-18 05:12:03 -0400 |
commit | 77dc80699c3be6c25e3b8f9e164e9f3084d9b938 (patch) | |
tree | ff6f33062eff141a1c6929428e69670cee11af6e /drivers/gpu/nvgpu/os | |
parent | 8c111d34f446568a2fe0c5db23366cb74118cd4c (diff) |
gpu: nvgpu: fix memleak when failed to power on gpu
nvmemleak detected memleak in the error path of gk20a_ctrl_dev_open.
nvkmemleak: Writing 'scan' to /sys/kernel/debug/kmemleak.
unreferenced object 0xffffffc0a6fffa80 (size 128):
comm "nvgpu_gpu_zcull", pid 9675, jiffies 4294948258 (age 195.764s)
hex dump (first 32 bytes):
10 28 09 ba c0 ff ff ff 00 00 69 b2 c0 ff ff ff .(........i.....
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffff800824cec4>] __kmalloc+0x26c/0x308
[<ffffff8000e70990>] __nvgpu_kzalloc+0x30/0x88 [nvgpu]
[<ffffff8000e71f70>] gk20a_ctrl_dev_open+0x60/0x108 [nvgpu]
[<ffffff800827ef20>] chrdev_open+0xb8/0x1d0
[<ffffff8008274654>] do_dentry_open+0x224/0x330
[<ffffff8008275c60>] vfs_open+0x58/0x90
[<ffffff800828aeb4>] do_last+0x3e4/0xd98
[<ffffff800828b90c>] path_openat+0xa4/0x2d8
[<ffffff800828cf0c>] do_filp_open+0x84/0x108
[<ffffff800827610c>] do_sys_open+0x164/0x278
[<ffffff80082762a4>] SyS_openat+0x3c/0x50
[<ffffff8008083600>] el0_svc_naked+0x34/0x38
[<ffffffffffffffff>] 0xffffffffffffffff
Bug 200422739
Change-Id: I4ad03713ef5c8fc0e213bf4b649d38829a54a1ac
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1777656
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Tested-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 17f1e923..f7de17ad 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | |||
@@ -102,8 +102,11 @@ int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | |||
102 | 102 | ||
103 | err = nvgpu_clk_arb_init_session(g, &priv->clk_session); | 103 | err = nvgpu_clk_arb_init_session(g, &priv->clk_session); |
104 | free_ref: | 104 | free_ref: |
105 | if (err) | 105 | if (err) { |
106 | gk20a_put(g); | 106 | gk20a_put(g); |
107 | if (priv) | ||
108 | nvgpu_kfree(g, priv); | ||
109 | } | ||
107 | return err; | 110 | return err; |
108 | } | 111 | } |
109 | int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp) | 112 | int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp) |