public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Navid Emamdoost <navid.emamdoost@gmail.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Sasha Levin <sashal@kernel.org>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 4.14 14/30] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
Date: Fri, 21 Aug 2020 12:18:41 -0400	[thread overview]
Message-ID: <20200821161857.348955-14-sashal@kernel.org> (raw)
In-Reply-To: <20200821161857.348955-1-sashal@kernel.org>

From: Navid Emamdoost <navid.emamdoost@gmail.com>

[ Upstream commit e008fa6fb41544b63973a529b704ef342f47cc65 ]

in amdgpu_display_crtc_set_config, the call to pm_runtime_get_sync
increments the counter even in case of failure, leading to incorrect
ref count. In case of failure, decrement the ref count before returning.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 6ad243293a78b..df24494299791 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -269,7 +269,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
 
 	ret = pm_runtime_get_sync(dev->dev);
 	if (ret < 0)
-		return ret;
+		goto out;
 
 	ret = drm_crtc_helper_set_config(set, ctx);
 
@@ -284,7 +284,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
 	   take the current one */
 	if (active && !adev->have_disp_power_ref) {
 		adev->have_disp_power_ref = true;
-		return ret;
+		goto out;
 	}
 	/* if we have no active crtcs, then drop the power ref
 	   we got before */
@@ -293,6 +293,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
 		adev->have_disp_power_ref = false;
 	}
 
+out:
 	/* drop the power reference we got coming in here */
 	pm_runtime_put_autosuspend(dev->dev);
 	return ret;
-- 
2.25.1


  parent reply	other threads:[~2020-08-21 16:50 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 16:18 [PATCH AUTOSEL 4.14 01/30] ALSA: pci: delete repeated words in comments Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 02/30] ASoC: tegra: Fix reference count leaks Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 03/30] mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 04/30] arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 05/30] powerpc/xive: Ignore kmemleak false positives Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 06/30] media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq() Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 07/30] blktrace: ensure our debugfs dir exists Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 08/30] scsi: target: tcmu: Fix crash on ARM during cmd completion Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 09/30] iommu/iova: Don't BUG on invalid PFNs Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 10/30] drm/amdkfd: Fix reference count leaks Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 11/30] drm/radeon: fix multiple reference count leak Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 12/30] drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 13/30] drm/amd/display: fix ref count leak in amdgpu_drm_ioctl Sasha Levin
2020-08-21 16:18 ` Sasha Levin [this message]
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 15/30] drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 16/30] scsi: lpfc: Fix shost refcount mismatch when deleting vport Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 17/30] selftests/powerpc: Purge extra count_pmc() calls of ebb selftests Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 18/30] omapfb: fix multiple reference count leaks due to pm_runtime_get_sync Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 19/30] PCI: Fix pci_create_slot() reference count leak Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 20/30] rtlwifi: rtl8192cu: Prevent leaking urb Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 21/30] mips/vdso: Fix resource leaks in genvdso.c Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 22/30] cec-api: prevent leaking memory through hole in structure Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 23/30] f2fs: fix use-after-free issue Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 24/30] drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 25/30] drm/nouveau: Fix reference count leak in nouveau_connector_detect Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 26/30] locking/lockdep: Fix overflow in presentation of average lock-time Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 27/30] scsi: iscsi: Do not put host in iscsi_set_flashnode_param() Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 28/30] ceph: fix potential mdsc use-after-free crash Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 29/30] scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del() Sasha Levin
2020-08-21 16:18 ` [PATCH AUTOSEL 4.14 30/30] EDAC/ie31200: Fallback if host bridge device is already initialized Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200821161857.348955-14-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox