Skip to content

Commit 9ba8923

Browse files
Navidemalexdeucher
authored andcommitted
drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms
in amdgpu_driver_open_kms 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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6f2e8ac commit 9ba8923

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
992992

993993
r = pm_runtime_get_sync(dev->dev);
994994
if (r < 0)
995-
return r;
995+
goto pm_put;
996996

997997
fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
998998
if (unlikely(!fpriv)) {
@@ -1043,6 +1043,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
10431043

10441044
out_suspend:
10451045
pm_runtime_mark_last_busy(dev->dev);
1046+
pm_put:
10461047
pm_runtime_put_autosuspend(dev->dev);
10471048

10481049
return r;

0 commit comments

Comments
 (0)