mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: fix memory leak in failure condition
This change frees tsg_private structure in nvgpu_ioctl_tsg_open() when gk20a_busy() fails and avoids a memory leak. Bug 2268533 JIRA NVGPU-1016 Change-Id: I0428cc40e042b881537f7cb597e5ebeaad815b32 Signed-off-by: Preetha Chandru R <pchandru@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1800955 Reviewed-by: Alex Waterman <alexw@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
e486ff45d0
commit
fec299954f
@@ -402,15 +402,14 @@ int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp)
|
||||
err = gk20a_busy(g);
|
||||
if (err) {
|
||||
nvgpu_err(g, "failed to power on, %d", err);
|
||||
goto free_ref;
|
||||
goto free_mem;
|
||||
}
|
||||
|
||||
tsg = gk20a_tsg_open(g, nvgpu_current_pid(g));
|
||||
gk20a_idle(g);
|
||||
if (!tsg) {
|
||||
nvgpu_kfree(g, priv);
|
||||
err = -ENOMEM;
|
||||
goto free_ref;
|
||||
goto free_mem;
|
||||
}
|
||||
|
||||
priv->g = g;
|
||||
@@ -421,6 +420,8 @@ int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp)
|
||||
|
||||
return 0;
|
||||
|
||||
free_mem:
|
||||
nvgpu_kfree(g, priv);
|
||||
free_ref:
|
||||
gk20a_put(g);
|
||||
return err;
|
||||
|
||||
Reference in New Issue
Block a user