Skip to content

Commit 4a4776e

Browse files
Aditya Pakkigregkh
authored andcommitted
drm/radeon: Fix reference count leaks caused by pm_runtime_get_sync
[ Upstream commit 9fb1067 ] On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error. Acked-by: Evan Quan <evan.quan@amd.com> Signed-off-by: Aditya Pakki <pakki001@umn.edu> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 59d2736 commit 4a4776e

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

drivers/gpu/drm/radeon/radeon_display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,10 @@ radeon_crtc_set_config(struct drm_mode_set *set,
625625
dev = set->crtc->dev;
626626

627627
ret = pm_runtime_get_sync(dev->dev);
628-
if (ret < 0)
628+
if (ret < 0) {
629+
pm_runtime_put_autosuspend(dev->dev);
629630
return ret;
631+
}
630632

631633
ret = drm_crtc_helper_set_config(set, ctx);
632634

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,10 @@ long radeon_drm_ioctl(struct file *filp,
523523
long ret;
524524
dev = file_priv->minor->dev;
525525
ret = pm_runtime_get_sync(dev->dev);
526-
if (ret < 0)
526+
if (ret < 0) {
527+
pm_runtime_put_autosuspend(dev->dev);
527528
return ret;
529+
}
528530

529531
ret = drm_ioctl(filp, cmd, arg);
530532

drivers/gpu/drm/radeon/radeon_kms.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,10 @@ int radeon_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
627627
file_priv->driver_priv = NULL;
628628

629629
r = pm_runtime_get_sync(dev->dev);
630-
if (r < 0)
630+
if (r < 0) {
631+
pm_runtime_put_autosuspend(dev->dev);
631632
return r;
633+
}
632634

633635
/* new gpu have virtual address space support */
634636
if (rdev->family >= CHIP_CAYMAN) {

0 commit comments

Comments
 (0)