All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/display: Fix logger leak on perf trace allocation failure
@ 2026-10-26 11:10 Jackie Liu
  0 siblings, 0 replies; only message in thread
From: Jackie Liu @ 2026-10-26 11:10 UTC (permalink / raw)
  To: harry.wentland
  Cc: sunpeng.li, alexander.deucher, christian.koenig, amd-gfx,
	dri-devel, linux-kernel

From: Jackie Liu <liuyun01@kylinos.cn>

dc_construct_ctx() allocates a logger and stores an alias in dc->dml.logger
before allocating the performance trace object. If dc_perf_trace_create()
fails, the function frees dc_ctx without releasing the logger. Since
dc->ctx is assigned only after the trace allocation succeeds,
dc_destruct() cannot reclaim the logger on this error path.

Free the logger before discarding dc_ctx and clear dc->dml.logger to avoid
leaving a dangling alias after the failed construction.

Fixes: 5d72e247e58c ("drm/amd/display: switch DC over to the new DRM logging macros")
Cc: stable@vger.kernel.org
Signed-off-by: Jackie Liu <liuyun01@kylinos.cn>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 1143916391e79..03179633cd036 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1022,6 +1022,8 @@ static bool dc_construct_ctx(struct dc *dc,
 
 	dc_ctx->perf_trace = dc_perf_trace_create();
 	if (!dc_ctx->perf_trace) {
+		kfree(dc_ctx->logger);
+		dc->dml.logger = NULL;
 		kfree(dc_ctx);
 		ASSERT_CRITICAL(false);
 		return false;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-26 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-26 11:10 [PATCH] drm/amd/display: Fix logger leak on perf trace allocation failure Jackie Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.