Re: [PATCH v2] drm/msm/dsi: Fix double put of the PHY device on probe deferral
From: Dmitry Baryshkov
Date: Fri Nov 27 2026 - 15:16:25 EST
On Fri, Nov 27, 2026 at 11:24:37PM +0800, Zhendong Liu wrote:
> Since commit 6977cc89c875 ("drm/msm/dsi: Fix some reference counted
> resource leaks"), dsi_get_phy() stores the PHY device it looked up in
> msm_dsi->phy_dev before it checks whether the PHY driver has bound, and
> dsi_destroy() drops that reference. dsi_init() calls dsi_destroy() when
> dsi_get_phy() fails.
>
> Commit c04c3148ca12 ("drm/msm/dsi: Fix missing put_device() call in
> dsi_get_phy") then added a put_device() for the case where the PHY
> device exists but has no driver data yet. In that case the reference is
> now dropped twice, once in dsi_get_phy() and again in dsi_destroy(), so
> each probe deferral for this reason takes one reference too many from
> the PHY platform device. Enough deferrals underflow its refcount and
> free it while it is still registered.
>
> fw_devlink normally keeps the DSI host from probing before its PHY has
> bound. The path is reached with fw_devlink=permissive or off, and after
> the deferred probe timeout when no driver matches the PHY device, as
> the device link is relaxed then and every probe retry of the DSI host
> drops another reference.
>
> Drop the put_device() and leave the reference to dsi_destroy(). This
> effectively reverts that commit and brings back the single check that
> it split in two.
>
> The double put was found with the help of an AI coding assistant during
> a review of the driver.
>
> Fixes: c04c3148ca12 ("drm/msm/dsi: Fix missing put_device() call in dsi_get_phy")
> Signed-off-by: Zhendong Liu <yzddmr6@xxxxxxxxx>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxxxxxxxx>
--
With best wishes
Dmitry