mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix: drm/amd/display: detect_link_and_local_sink: DP alt mode timeout   path leaks prev_sink reference
@ 2026-06-26 12:45 WenTao Liang
  2026-06-26 19:02 ` Mario Limonciello
  0 siblings, 1 reply; 2+ messages in thread
From: WenTao Liang @ 2026-06-26 12:45 UTC (permalink / raw)
  To: harry.wentland, sunpeng.li, alexander.deucher, christian.koenig,
	airlied, simona
  Cc: siqueira, alex.hung, timur.kristof, wenjing.liu, Relja.Vojvodic,
	superm1, Derek.Lai, srinivasan.shanmugam, clayking, amd-gfx,
	dri-devel, linux-kernel, WenTao Liang, stable

prev_sink is unconditionally retained via dc_sink_retain at function
  entry, but the DP alt mode timeout path inside SIGNAL_TYPE_DISPLAY_PORT
  returns false without releasing prev_sink. All other return paths in the
  function correctly call dc_sink_release(prev_sink), making this the only
  missing cleanup.

Cc: stable@vger.kernel.org
Fixes: 54618888d1ea ("drm/amd/display: break down dc_link.c")
Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
---
 drivers/gpu/drm/amd/display/dc/link/link_detection.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
index 794dd6a95918..03bb210ebab8 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
@@ -1069,8 +1069,11 @@ static bool detect_link_and_local_sink(struct dc_link *link,
 			    link->link_enc->features.flags.bits.DP_IS_USB_C == 1) {
 
 				/* if alt mode times out, return false */
-				if (!wait_for_entering_dp_alt_mode(link))
+				if (!wait_for_entering_dp_alt_mode(link)) {
+					if (prev_sink)
+						dc_sink_release(prev_sink);
 					return false;
+				}
 			}
 
 			if (!detect_dp(link, &sink_caps, reason)) {
-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix: drm/amd/display: detect_link_and_local_sink: DP alt mode timeout path leaks prev_sink reference
  2026-06-26 12:45 [PATCH] fix: drm/amd/display: detect_link_and_local_sink: DP alt mode timeout path leaks prev_sink reference WenTao Liang
@ 2026-06-26 19:02 ` Mario Limonciello
  0 siblings, 0 replies; 2+ messages in thread
From: Mario Limonciello @ 2026-06-26 19:02 UTC (permalink / raw)
  To: WenTao Liang, harry.wentland, sunpeng.li, alexander.deucher,
	christian.koenig, airlied, simona
  Cc: siqueira, alex.hung, timur.kristof, wenjing.liu, Relja.Vojvodic,
	Derek.Lai, srinivasan.shanmugam, clayking, amd-gfx, dri-devel,
	linux-kernel, stable

On 6/26/26 07:45, WenTao Liang wrote:
> prev_sink is unconditionally retained via dc_sink_retain at function
>    entry, but the DP alt mode timeout path inside SIGNAL_TYPE_DISPLAY_PORT
>    returns false without releasing prev_sink. All other return paths in the
>    function correctly call dc_sink_release(prev_sink), making this the only
>    missing cleanup.
> 
> Cc: stable@vger.kernel.org
> Fixes: 54618888d1ea ("drm/amd/display: break down dc_link.c")
> Signed-off-by: WenTao Liang <vulab@iscas.ac.cn>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>

Applied, thanks.

> ---
>   drivers/gpu/drm/amd/display/dc/link/link_detection.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/link/link_detection.c b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
> index 794dd6a95918..03bb210ebab8 100644
> --- a/drivers/gpu/drm/amd/display/dc/link/link_detection.c
> +++ b/drivers/gpu/drm/amd/display/dc/link/link_detection.c
> @@ -1069,8 +1069,11 @@ static bool detect_link_and_local_sink(struct dc_link *link,
>   			    link->link_enc->features.flags.bits.DP_IS_USB_C == 1) {
>   
>   				/* if alt mode times out, return false */
> -				if (!wait_for_entering_dp_alt_mode(link))
> +				if (!wait_for_entering_dp_alt_mode(link)) {
> +					if (prev_sink)
> +						dc_sink_release(prev_sink);
>   					return false;
> +				}
>   			}
>   
>   			if (!detect_dp(link, &sink_caps, reason)) {


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-26 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26 12:45 [PATCH] fix: drm/amd/display: detect_link_and_local_sink: DP alt mode timeout path leaks prev_sink reference WenTao Liang
2026-06-26 19:02 ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®