* Re: [PATCH] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
@ 2020-06-14 13:05 Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2020-06-14 13:05 UTC (permalink / raw)
To: Navid Emamdoost, amd-gfx, dri-devel
Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Qiushi Wu,
kernel-janitors, linux-kernel, Alex Deucher, Andrey Grodzovsky,
Christian König, Shirish S, Daniel Vetter, David Airlie,
Lyude Paul, Thomas Zimmermann, Yu Kuai
> in amdgpu_display_crtc_set_config, …
* Can the term “reference count” become relevant also for this commit message
besides other possible adjustments?
* Can it be nicer to combine proposed updates for this software module
as a patch series (with a cover letter)?
* Would you like to add the tag “Fixes”?
…
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
…
> @@ -306,6 +306,7 @@ int amdgpu_display_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;
Perhaps use the label “put_runtime” instead?
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
@ 2020-06-14 7:09 Navid Emamdoost
0 siblings, 0 replies; 2+ messages in thread
From: Navid Emamdoost @ 2020-06-14 7:09 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Daniel Vetter,
Andrey Grodzovsky, Lyude Paul, Thomas Zimmermann, Shirish S,
yu kuai, Navid Emamdoost, amd-gfx, dri-devel, linux-kernel
Cc: emamd001, wu000273, kjlu, smccaman
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>
---
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 f7143d927b6d..5e51f0acf744 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -282,7 +282,7 @@ int amdgpu_display_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);
@@ -297,7 +297,7 @@ int amdgpu_display_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 */
@@ -306,6 +306,7 @@ int amdgpu_display_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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-14 13:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 13:05 [PATCH] drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-06-14 7:09 Navid Emamdoost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).