2026年11月16日 14:57, "Markus Elfring" <[email protected] 
mailto:[email protected]?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 via email to