Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/xe/display: double encoder->remove() on
  xe_display_init_early() error
--

commit b715fa7a2b526531416f015bc7f326dd1dd557ca
Author: Baoli Zhang <[email protected]>

drm/xe/display: Free the KMS objects on DRM device release

This commit removes the calls to intel_display_driver_mode_config_cleanup()
from xe_display_fini_early() and the xe_display_init_early() error path so
that KMS objects are freed by drmm on DRM device release.

> diff --git a/drivers/gpu/drm/xe/display/xe_display.c 
> b/drivers/gpu/drm/xe/display/xe_display.c
> index 8f02317a62120..639c2f5aeb66f 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c

[ ... ]

> @@ -111,7 +114,6 @@ int xe_display_init_early(struct xe_device *xe)
>       return devm_add_action_or_reset(xe->drm.dev, xe_display_fini_early, xe);
>  err_noirq:
>       intel_display_driver_remove_noirq(display);
> -     intel_display_driver_mode_config_cleanup(display);
>       intel_display_power_cleanup(display);
>  
>       return err;

[Severity: Medium]
Can the err_noirq path in xe_display_init_early() invoke encoder->remove()
twice on each encoder when intel_display_driver_probe_nogem() fails?

In intel_display_driver_probe_nogem(), if intel_dp_tunnel_mgr_init() fails
after intel_setup_outputs(), the err_mode_config path calls
intel_mode_config_cleanup() -> intel_encoder_remove_all(). Because
drm_mode_config_cleanup() is now deferred to drmm, the encoders remain
linked on display->drm->mode_config.encoder_list when
intel_display_driver_probe_nogem() returns an error.

The err_noirq path here then calls intel_display_driver_remove_noirq() ->
intel_mode_config_cleanup() -> intel_encoder_remove_all() a second time on
the still-populated encoder_list. On the first pass,
intel_ddi_encoder_remove() frees dig_port->tc and sets it to NULL in
intel_tc_port_cleanup() and frees intel_dp->aux.name in
intel_dp_aux_fini(), so the second pass causes a NULL pointer dereference
in intel_tc_port_suspend() and a double free of intel_dp->aux.name.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=3

Reply via email to