Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/vmwgfx: leak of ldu_priv in vmw_kms_init() on initial
  state error
--

commit 5f937b8ad11b4bd1a6956c12405bef9b28767c1f
Author: Maxime Ripard <[email protected]>

drm/vmwgfx: Switch to drm_mode_config_create_initial_state

This commit replaces the drm_mode_config_reset() calls in the individual
display unit init functions with a single
drm_mode_config_create_initial_state() call in vmw_kms_init().

> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 90ab9380d8830..4924649033bb7 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1175,11 +1175,23 @@ int vmw_kms_init(struct vmw_private *dev_priv)
>               if (ret) /* Fallback */
>                       ret = vmw_kms_ldu_init_display(dev_priv);
>       }
> +     if (ret)
> +             return ret;
> +
>       BUILD_BUG_ON(ARRAY_SIZE(display_unit_names) != (vmw_du_max + 1));
>       drm_info(&dev_priv->drm, "%s display unit initialized\n",
>                display_unit_names[dev_priv->active_display_unit]);
>  
> -     return ret;
> +     /*
> +      * Create the initial state once, after the display unit that will
> +      * be used has been settled on: a failure in one of the display
> +      * unit initialization functions is used as a fallback condition to
> +      * try the next one, and creating the state on a partially
> +      * initialized device would both leave the KMS objects of the two
> +      * backends on the same drm_device and trip WARN_ON() on the objects
> +      * that don't have a state.
> +      */
> +     return drm_mode_config_create_initial_state(dev);
>  }

[Severity: Medium]
Does this leak dev_priv->ldu_priv if drm_mode_config_create_initial_state()
fails after falling back to vmw_kms_ldu_init_display()?

vmw_kms_ldu_init_display() allocates dev_priv->ldu_priv with kmalloc_obj(),
which is only freed by vmw_kms_close() -> vmw_kms_ldu_close_display(). When
vmw_kms_init() returns an error here, vmw_driver_load() jumps to out_no_kms
and skips vmw_kms_close().

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

Reply via email to