Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/msm/dp: unlocked mst_active check in
  msm_dp_bridge_detect()
--

commit 1b5162231829036e89b5c051fc2a3d4cb1ae0463
Author: Abhinav Kumar <[email protected]>

drm/msm/dp: mark the SST bridge disconnected when mst is active

This commit skips SST bridge detection in msm_dp_bridge_detect() and returns
connector_status_disconnected when dp->mst_active is set.

> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
> b/drivers/gpu/drm/msm/dp/dp_display.c
> index 75eaf739b86f0..17487a7900d00 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -976,7 +976,11 @@ enum drm_connector_status msm_dp_bridge_detect(struct 
> drm_bridge *bridge,
>  
>       priv = container_of(dp, struct msm_dp_display_private, msm_dp_display);
>  
> +     if (dp->mst_active)
> +             return status;
> +
>       guard(mutex)(&priv->plugged_lock);
> +
>       ret = pm_runtime_resume_and_get(&dp->pdev->dev);
>       if (ret) {
>               DRM_ERROR("failed to pm_runtime_resume\n");

[Severity: Medium]
Should dp->mst_active be checked after acquiring priv->plugged_lock, as
msm_dp_irq_hpd_handle() does?

drm_bridge_connector_handle_hpd() invokes drm_bridge_connector_hpd_notify()
without holding dev->mode_config.mutex, so priv->plugged_lock is the only
lock serializing HPD plug handling against concurrent connector probing:

CPU0                                  CPU1
msm_dp_hpd_plug_handle()
  lock(&priv->plugged_lock)
  ...
                                      msm_dp_bridge_detect()
                                        if (dp->mst_active) // false
                                        lock(&priv->plugged_lock) // blocks
    dp->mst_active = true
    priv->plugged = true
  unlock(&priv->plugged_lock)
                                        pm_runtime_resume_and_get(...)
                                        ...  <-- runs SST detect in MST mode

When CPU1 enters the SST detection path after MST is enabled, a successful
DPCD read leaves an extra runtime PM reference leaked (because priv->plugged
is true at the end label and msm_dp_hpd_unplug_handle() only drops one
reference), while a transient AUX read failure resets priv->plugged to false
and causes a subsequent unplug to return early without tearing down the MST
topology manager.

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

Reply via email to