dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jackie Liu" <liu.yun@linux.dev>
To: "Markus Elfring" <Markus.Elfring@web.de>,
	"Jackie Liu" <liuyun01@kylinos.cn>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Harry Wentland" <harry.wentland@amd.com>,
	"Leo Li" <sunpeng.li@amd.com>, "Wayne Lin" <Wayne.Lin@amd.com>
Cc: "LKML" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amd/display: Fix logger leak on perf trace allocation failure
Date: Mon, 16 Nov 2026 07:42:00 +0000	[thread overview]
Message-ID: <eecbc1d7670554d2c11273331b6af9855d58d79d@linux.dev> (raw)
In-Reply-To: <ae04eef3-ec99-4728-be84-8a71e16c0b4e@web.de>

2026年11月16日 14:57, "Markus Elfring" <Markus.Elfring@web.de mailto:Markus.Elfring@web.de?to=%22Markus%20Elfring%22%20%3CMarkus.Elfring%40web.de%3E > 写到:


> 
> …
> 
> > 
> > Free the logger before discarding dc_ctx and clear dc->dml.logger to avoid
> >  leaving a dangling alias after the failed construction.
> > 
> Would there be a need to complete the exception handling also after a failed
> link_create_link_service() call in the implementation of the function “dc_construct_ctx”?
> https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/gpu/drm/amd/display/dc/core/dc.c#L990-L1037

Hi Markus,

Thanks for taking a look.

The link_create_link_service() failure is already covered by the
caller's cleanup. dc->ctx is assigned before that call. On failure,
both the normal and virtual hardware paths reach the destruct_dc
label in dc_create(), where dc_destruct() releases the logger,
perf_trace, and context.

The perf_trace allocation failure happens before dc->ctx is assigned,
so dc_destruct() cannot reach the logger in that case. That is the
leak this patch addresses.

Using common cleanup labels for the early failure paths would be a
reasonable separate cleanup. For this stable-targeted fix, I would
prefer to keep the change limited to the missing logger cleanup.

Best regards,
Jackie

> 
> How do you think about to avoid duplicate source code another bit?
> 
> Regards,
> Markus
>

      reply	other threads:[~2026-11-16  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 11:10 [PATCH] drm/amd/display: Fix logger leak on perf trace allocation failure Jackie Liu
2026-11-15  7:08 ` Wayne Lin
2026-11-16  6:57 ` Markus Elfring
2026-11-16  7:42   ` Jackie Liu [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=eecbc1d7670554d2c11273331b6af9855d58d79d@linux.dev \
    --to=liu.yun@linux.dev \
    --cc=Markus.Elfring@web.de \
    --cc=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=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