RE: [PATCH 023/190] Revert "drm/radeon: fix multiple reference count leak"

From: Deucher, Alexander
Date: Wed Apr 21 2021 - 12:07:25 EST


[AMD Public Use]

> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, April 21, 2021 8:58 AM
> To: linux-kernel@xxxxxxxxxxxxxxx
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; Aditya Pakki
> <pakki001@xxxxxxx>; Deucher, Alexander
> <Alexander.Deucher@xxxxxxx>
> Subject: [PATCH 023/190] Revert "drm/radeon: fix multiple reference count
> leak"
>
> This reverts commit 6f2e8acdb48ed166b65d47837c31b177460491ec.
>
> Commits from @umn.edu addresses have been found to be submitted in
> "bad faith" to try to test the kernel community's ability to review "known
> malicious" changes. The result of these submissions can be found in a paper
> published at the 42nd IEEE Symposium on Security and Privacy entitled,
> "Open Source Insecurity: Stealthily Introducing Vulnerabilities via Hypocrite
> Commits" written by Qiushi Wu (University of Minnesota) and Kangjie Lu
> (University of Minnesota).
>
> Because of this, all submissions from this group must be reverted from the
> kernel tree and will need to be re-reviewed again to determine if they
> actually are a valid fix. Until that work is complete, remove this change to
> ensure that no problems are being introduced into the codebase.
>
> Cc: Aditya Pakki <pakki001@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

AFAICT, this patch is correct or at least does no harm. Handling of pm_runtime_get_sync() errors in the kernel seems to be inconsistent at best.

Alex

> ---
> drivers/gpu/drm/radeon/radeon_connectors.c | 20 +++++---------------
> 1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index 607ad5620bd9..ba8885676676 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -879,10 +879,8 @@ 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) {
> - pm_runtime_put_autosuspend(connector->dev-
> >dev);
> + if (r < 0)
> return connector_status_disconnected;
> - }
> }
>
> if (encoder) {
> @@ -1027,10 +1025,8 @@ 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) {
> - pm_runtime_put_autosuspend(connector->dev-
> >dev);
> + if (r < 0)
> return connector_status_disconnected;
> - }
> }
>
> encoder = radeon_best_single_encoder(connector);
> @@ -1167,10 +1163,8 @@ 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) {
> - pm_runtime_put_autosuspend(connector->dev-
> >dev);
> + if (r < 0)
> return connector_status_disconnected;
> - }
> }
>
> encoder = radeon_best_single_encoder(connector);
> @@ -1253,10 +1247,8 @@ 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) {
> - pm_runtime_put_autosuspend(connector->dev-
> >dev);
> + if (r < 0)
> return connector_status_disconnected;
> - }
> }
>
> if (radeon_connector->detected_hpd_without_ddc) { @@ -1665,10
> +1657,8 @@ 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) {
> - pm_runtime_put_autosuspend(connector->dev-
> >dev);
> + if (r < 0)
> return connector_status_disconnected;
> - }
> }
>
> if (!force && radeon_check_hpd_status_unchanged(connector)) {
> --
> 2.31.1