Skip to content

Commit

Permalink
drm/amd/display: fix ref count leak in amdgpu_drm_ioctl
Browse files Browse the repository at this point in the history
[ Upstream commit 5509ac6 ]

in amdgpu_drm_ioctl the call to pm_runtime_get_sync increments the
counter even in case of failure, leading to incorrect
ref count. In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Navidem authored and gregkh committed Sep 3, 2020
1 parent c911da7 commit 3753eff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Expand Up @@ -1286,11 +1286,12 @@ long amdgpu_drm_ioctl(struct file *filp,
dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev);
if (ret < 0)
return ret;
goto out;

ret = drm_ioctl(filp, cmd, arg);

pm_runtime_mark_last_busy(dev->dev);
out:
pm_runtime_put_autosuspend(dev->dev);
return ret;
}
Expand Down

0 comments on commit 3753eff

Please sign in to comment.