[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1587618202-13283-1-git-send-email-xiyuyang19@fudan.edu.cn>
Date: Thu, 23 Apr 2020 13:03:11 +0800
From: Xiyu Yang <xiyuyang19@...an.edu.cn>
To: Harry Wentland <harry.wentland@....com>,
Leo Li <sunpeng.li@....com>,
Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"David (ChunMing) Zhou" <David1.Zhou@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Bhawanpreet Lakha <Bhawanpreet.Lakha@....com>,
Jun Lei <Jun.Lei@....com>, Anthony Koo <Anthony.Koo@....com>,
Zhan Liu <Zhan.Liu@....com>, Eric Yang <Eric.Yang2@....com>,
Wenjing Liu <Wenjing.Liu@....com>,
Chris Park <Chris.Park@....com>, Roman Li <Roman.Li@....com>,
David Galiffi <David.Galiffi@....com>,
Lucy Li <lucy.li@....com>, Paul Hsieh <paul.hsieh@....com>,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: yuanxzhang@...an.edu.cn, kjlu@....edu,
Xiyu Yang <xiyuyang19@...an.edu.cn>,
Xin Tan <tanxin.ctf@...il.com>
Subject: [PATCH] drm/amdgpu/display: Fix dc_sink refcnt leak in dc_link_detect_helper
dc_link_detect_helper() invokes dc_sink_retain(), which increases the
refcount of the "prev_sink".
When dc_link_detect_helper() returns, local variable "prev_sink" becomes
invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of
dc_link_detect_helper(). When alt mode times out, the function forgets
to decrease the refcnt increased by dc_sink_retain(), causing a refcnt
leak.
Fix this issue by calling dc_sink_release() when alt mode times out.
Signed-off-by: Xiyu Yang <xiyuyang19@...an.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@...il.com>
---
drivers/gpu/drm/amd/display/dc/core/dc_link.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
index a09119c10d7c..91550d9a1abb 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c
@@ -832,6 +832,8 @@ static bool dc_link_detect_helper(struct dc_link *link,
/* if alt mode times out, return false */
if (wait_for_alt_mode(link) == false) {
+ if (prev_sink != NULL)
+ dc_sink_release(prev_sink);
return false;
}
}
--
2.7.4
Powered by blists - more mailing lists