On Mon, Nov 30, 2026 at 07:09:11AM +0000, [email protected] wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [High] drm/msm/dp: use-after-free of dp->aux after
>   msm_dp_display_remove()
> --
> 
> commit ffc44dc305e10f09be11226df97e5b2a91916044
> Author: Yuanjie Yang <[email protected]>
> 
> drm/msm/dp: don't depopulate the eDP AUX bus on component unbind
> 
> This commit stops calling of_dp_aux_depopulate_bus() in
> msm_dp_display_unbind() so that eDP AUX bus teardown is left to the devm
> action registered at probe time.
> 
> > diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
> > b/drivers/gpu/drm/msm/dp/dp_display.c
> > index c0c150e2c5758..895174e047312 100644
> > --- a/drivers/gpu/drm/msm/dp/dp_display.c
> > +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> > @@ -239,8 +239,6 @@ static void msm_dp_display_unbind(struct device *dev, 
> > struct device *master,
> >     struct msm_dp_display_private *dp = dev_get_dp_display_private(dev);
> >     struct msm_drm_private *priv = dev_get_drvdata(master);
> >  
> > -   of_dp_aux_depopulate_bus(dp->aux);
> > -
> >     msm_dp_aux_unregister(dp->aux);
> >     dp->drm_dev = NULL;
> >     dp->aux->drm_dev = NULL;
> 
> [Severity: High]
> Does deferring AUX bus depopulation to the devm action cause a
> use-after-free of dp->aux during msm_dp_display_remove()?
> 
> When the platform device is removed, msm_dp_display_remove() runs before
> devres_release_all():
> 
> drivers/gpu/drm/msm/dp/dp_display.c:msm_dp_display_remove() {
>       struct msm_dp_display_private *dp = 
> dev_get_dp_display_private(&pdev->dev);
> 
>       component_del(&pdev->dev, &msm_dp_display_comp_ops);
>       msm_dp_display_deinit_sub_modules(dp);
>       platform_set_drvdata(pdev, NULL);
> }
> 
> msm_dp_display_deinit_sub_modules() calls msm_dp_aux_put(dp->aux), which
> destroys aux->mutex and calls devm_kfree(aux->dev, aux).  When
> devres_release_all() then runs the devm_of_dp_aux_populate_bus() cleanup
> action, of_dp_aux_depopulate_bus_void(dp->aux) dereferences aux->dev from
> the already-freed dp->aux and tears down the child AUX endpoint device
> after dp->aux and aux->mutex have been destroyed.
I mentioned this issue in the cover letter. this can be reproduce by
rmmod msm. will fix in other patch.

Thanks,
Yuanjie

> -- 
> Sashiko AI review ยท 
> https://sashiko.dev/#/patchset/20261130-dpu_unbind_rebind_display-v1-0-c335387de...@oss.qualcomm.com?part=2

Reply via email to