Skip to content

Commit

Permalink
drm/radeon: fix multiple reference count leak
Browse files Browse the repository at this point in the history
[ Upstream commit 6f2e8ac ]

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.

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>
  • Loading branch information
Aditya Pakki authored and gregkh committed Sep 3, 2020
1 parent d312f43 commit bedae9f
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions drivers/gpu/drm/radeon/radeon_connectors.c
Expand Up @@ -879,8 +879,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)

if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0)
if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected;
}
}

if (encoder) {
Expand Down Expand Up @@ -1025,8 +1027,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force)

if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0)
if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected;
}
}

encoder = radeon_best_single_encoder(connector);
Expand Down Expand Up @@ -1163,8 +1167,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force)

if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0)
if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected;
}
}

encoder = radeon_best_single_encoder(connector);
Expand Down Expand Up @@ -1247,8 +1253,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)

if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0)
if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected;
}
}

if (radeon_connector->detected_hpd_without_ddc) {
Expand Down Expand Up @@ -1657,8 +1665,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)

if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0)
if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected;
}
}

if (!force && radeon_check_hpd_status_unchanged(connector)) {
Expand Down

0 comments on commit bedae9f

Please sign in to comment.