Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] drm/bridge: cdns-mhdp8546: use-after-free in cdns_mhdp_fw_cb() [1] --
commit 23a21b2ed969a0e335bad1cc0a8b7a4ecba91485 Author: Abhash Kumar Jha <[email protected]> drm/bridge: cdns-mhdp8546: Power on/off the PHY in probe/remove This commit adds phy_power_on() and phy_power_off() calls alongside phy_init() and phy_exit() in cdns_mhdp_probe() and cdns_mhdp_remove(). > diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > index f47717bd10798..86e850a4752dc 100644 > --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c > +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c [ ... ] > @@ -2424,6 +2432,7 @@ static void cdns_mhdp_remove(struct platform_device > *pdev) > ERR_PTR(ret)); > } > > + phy_power_off(mhdp->phy); > phy_exit(mhdp->phy); > > if (mhdp->info && mhdp->info->ops && mhdp->info->ops->exit) [Severity: Critical] This problem wasn't introduced by this patch, but can cdns_mhdp_fw_cb() trigger a use-after-free on mhdp [1] if firmware loading takes longer than the 100ms timeout in cdns_mhdp_remove()? cdns_mhdp_load_firmware() starts an asynchronous request with request_firmware_nowait(), passing the devres-managed mhdp as the callback context. If wait_event_timeout() in cdns_mhdp_remove() expires before the firmware finishes loading, cdns_mhdp_remove() logs an error and returns without cancelling or waiting for the request: drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c:cdns_mhdp_remove() { ... ret = wait_event_timeout(mhdp->fw_load_wq, mhdp->hw_state == MHDP_HW_READY, timeout); spin_lock(&mhdp->start_lock); mhdp->hw_state = MHDP_HW_STOPPED; spin_unlock(&mhdp->start_lock); if (ret == 0) { dev_err(mhdp->dev, "%s: Timeout waiting for fw loading\n", __func__); } else { ... } After cdns_mhdp_remove() returns, devres cleanup frees mhdp, and when the pending request completes later, cdns_mhdp_fw_cb() dereferences the freed mhdp pointer. [1] https://sashiko.dev/#/bug/linux-745c94fb-512f-4afa-95f5-092458e19f3a -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1
