Hi Fabio, On Wed, Sep 09, 2026 at 06:02:13PM -0300, Fabio Estevam wrote: > lcdif allocates its private data, which embeds the CRTC and primary > plane, and its encoders using devres. These DRM objects are linked into > the mode_config lists. > > Since mode_config cleanup is DRM-managed, it is deferred until the DRM > device is released. An open DRM file can keep the DRM device alive after > the platform device has been unbound and devres has freed those objects. > The later mode_config cleanup then dereferences freed memory. > > Allocate the private data with drmm before initializing mode_config so > that it remains alive until mode_config cleanup has completed. Allocate > encoders with drmm_plain_encoder_alloc(), which cleans up each encoder > and removes it from the mode_config list before freeing its memory. > > This can be reproduced on i.MX8MP by keeping the DRM card open across an > LCDIF unbind and closing it afterwards. > > Cc: [email protected] > Fixes: 1c71d925c03a ("drm: lcdif: Switch to drmm_mode_config_init") > Signed-off-by: Fabio Estevam <[email protected]>
Just a heads-up, this patch will not apply on latest linux-next. Probably because devm_kzalloc() was swapped for devm_kzalloc_obj() in latest tree. So, you may need to send a v2 anyway. But other than that, Reviewed-by: Laurentiu Palcu <[email protected]> -- Thanks, Laurentiu
