Re: [PATCH] drm/amd/display: Fix pdev lifetime in dm_test_conn_init_ctx_alloc()
From: Tao Liu
Date: Thu Nov 26 2026 - 05:41:40 EST
Hi Chen-Yu,
On Wed, Nov 25, 2026 at 11:31 PM Chen, Chen-Yu <Chen-Yu.Chen@xxxxxxx> wrote:
>
>
> > Fix this by allocating pdev with kzalloc() and freeing it through
> > the device release callback. This ensures pdev's lifetime is managed
> > solely by the kobject.
>
> Hi Tao,
>
> Thanks for the report.
>
> The lifetime problem in dm_test_conn_init_ctx_alloc() is real, but it has
> already been addressed in amd-staging-drm-next by commit 370bab028b38
> ("drm/amd/display: Add more connector KUnit tests"). That commit allocates
> pdev with devm_kzalloc() on the device and registers the unregister action
> with devm_add_action_or_reset(), so devres releases the i2c adapter before
> pdev is freed.
Thanks for the info, I didn't notice the issue has already been fixed.
>
> Your patch no longer applies to the current tree for that reason. Could you
> please rebase it onto the latest amd-staging-drm-next and confirm whether the
> issue still reproduces?
I tested the latest amd-staging-drm-next, the use-after-free issue
doesn't reproduce, so my patch is no longer needed. Thanks again for
your review and comments!
Thanks,
Tao Liu
>
> Thanks,
> Chenyu
>