Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1892481pxk; Tue, 1 Sep 2020 10:09:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws8jk9aRieYhMnKFsYKbXCwR9nN6o0VkfXik2GlKSferVKWxZsglDIAvELEjs8oD8LarBh X-Received: by 2002:aa7:d6c6:: with SMTP id x6mr2694634edr.338.1598980195690; Tue, 01 Sep 2020 10:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598980195; cv=none; d=google.com; s=arc-20160816; b=yw70xKjPWMMxbivzTyxaH/jxC7iJWjsESUBkGC2rhp4o7W6nbIsZFxkIt3JyPDn2TD R5wXkMn8gae8zPQLSVPCSKajwH2qSkzzNAok3SoBpV3OEOc/WOBlnDAu7UYNUJ8OjfgQ lzdHUmUTZcH9kkdF4eVvSJIA5IuV90ZGhm9mkqnppK6TWd2i8oedcNFFbVakzQy9XZib McR1lN5nIE77cLcqfDA9V3A0f+RPPgApUljkBXN9vT4L7B0E4y9EKHHbOWp19nv+mBtQ TDk/Wj/TShzcNvuapYl3aA4ehSO1hQbPTQG9RJqUceF7eRDz/9aRPEwk/mfyTwYRk0BL wioA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ddYCZIh9o3JBzLPa1knO5ko2G2ncPezFNKfSGK3B15c=; b=TQ2N4Qseg+DYHuy+F4ppXL2nRvY6+lW8WVY6JOM6n/3AYj75CCMaGgnU//3eoKzcxk UswH1WfAz36k3pREtYZB1ORZvRcQFpjlHMxgyKn0qh66YxgPFGBdOkiDRDZDlTftqCBD JtSuKaXY3Yd39yHeZdFlng86R2g1quldfN1npZmoRQGiUK1gIg22HVS+JVD8joth++Fx sOSgz64tuAedhIQ/R2BUFgABOy/+l0e+0/YKAn9oDcYmPUh5+fMtXZN1N1dMbtSY6X3a z+SU0XG/WlLjSD7N1xk4WdCshlo+3+kILim1SBiABTdS8AAIvcf6a7cVUgPrlqx/UV6d oe3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JvNiXFHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rh17si903939ejb.256.2020.09.01.10.09.31; Tue, 01 Sep 2020 10:09:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JvNiXFHp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729402AbgIARIg (ORCPT + 99 others); Tue, 1 Sep 2020 13:08:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:35852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729089AbgIAPSB (ORCPT ); Tue, 1 Sep 2020 11:18:01 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE631206EB; Tue, 1 Sep 2020 15:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973480; bh=A+uSJSI2lbyDrwDMPuRGn2pevA9RnzTnmihHE5KY4r4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JvNiXFHpHF2sKfg5yP74WRg3mW4NvMBOmccaYmA8/j0WZcmiiK8m3hJYIvBWbDegR yYfHfXF9A4DsArk+diiFxETf7yzGj8hhWgWEnfy/sTOqpr2kW5jUbTw4nqLYsvpM6v l1fmlsjMPcYmUClwcgFFHz0LkiP2JEs8DYyNbdzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aditya Pakki , Alex Deucher , Sasha Levin Subject: [PATCH 4.14 16/91] drm/radeon: fix multiple reference count leak Date: Tue, 1 Sep 2020 17:09:50 +0200 Message-Id: <20200901150928.920290676@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150928.096174795@linuxfoundation.org> References: <20200901150928.096174795@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Aditya Pakki [ Upstream commit 6f2e8acdb48ed166b65d47837c31b177460491ec ] 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 Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/radeon_connectors.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 48f752cf7a920..fc021b8e4077d 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c @@ -895,8 +895,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) { @@ -1041,8 +1043,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); @@ -1179,8 +1183,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); @@ -1263,8 +1269,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) { @@ -1704,8 +1712,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)) { -- 2.25.1