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

Deucher, Alexander
2021-04-21T16:07:25Z

[AMD Public Use]

> -----Original Message-----
> From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Sent: Wednesday, April 21, 2021 8:58 AM
> To: linux-kernel@vger.kernel.org
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Aditya Pakki
> <pakki001@umn.edu>; Deucher, Alexander
> <Alexander.Deucher@amd.com>
> 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@umn.edu>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

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