From: Wayne Lin <Wayne.Lin@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Jackie Liu <liu.yun@linux.dev>, Jackie Liu <liuyun01@kylinos.cn>,
<harry.wentland@amd.com>, <sunpeng.li@amd.com>,
<alexander.deucher@amd.com>, <christian.koenig@amd.com>,
<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Fix logger leak on perf trace allocation failure
Date: Sun, 15 Nov 2026 15:08:01 +0800 [thread overview]
Message-ID: <20261115070801.1465490-1-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20261026111047.97178-1-liu.yun@linux.dev>
Reviewed-by: Wayne Lin <Wayne.Lin@amd.com>
On Mon, 26 Oct 2026 19:10:47 +0800, Jackie Liu wrote:
> 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
>
>
prev parent reply other threads:[~2026-11-15 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 11:10 Jackie Liu
2026-11-15 7:08 ` Wayne Lin [this message]
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=20261115070801.1465490-1-Wayne.Lin@amd.com \
--to=wayne.lin@amd.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=liu.yun@linux.dev \
--cc=liuyun01@kylinos.cn \
--cc=sunpeng.li@amd.com \
/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
all inboxes | Powered by JetHome®