Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/bridge: it6505: missing IRQ sync in it6505_poweroff()
  allows work requeue
--

commit 047992d501bf36c86f72d05d9e0cb5d26d252fa0
Author: Daniel Golle <[email protected]>

drm/bridge: it6505: quiesce work items before powering off

This commit cancels link_works, hdcp_wait_ksv_list, and hdcp_work in
it6505_poweroff() before asserting reset and disabling the power rails.

> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c 
> b/drivers/gpu/drm/bridge/ite-it6505.c
> index e980cc6d5760c..52d7d818a5ea3 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -2804,6 +2804,9 @@ static int it6505_poweroff(struct it6505 *it6505)
>       }
>  
>       disable_irq_nosync(it6505->irq);
> +     cancel_work_sync(&it6505->link_works);
> +     cancel_work_sync(&it6505->hdcp_wait_ksv_list);
> +     cancel_delayed_work_sync(&it6505->hdcp_work);
>  
>       if (pdata->gpiod_reset)
>               gpiod_set_value_cansleep(pdata->gpiod_reset, 1);

[Severity: Medium]
Can an in-flight it6505_int_threaded_handler() requeue these work items
right after cancel_work_sync() and cancel_delayed_work_sync() return?

During system suspend, pm_runtime_force_suspend() disables runtime PM
and calls it6505_bridge_suspend() -> it6505_poweroff() without waiting
for a running threaded IRQ handler. Because it6505_poweroff() uses
disable_irq_nosync(), an already-running handler can schedule work
after the synchronous cancels finish:

CPU0                                  CPU1 (irq/it6505-int)
it6505_int_threaded_handler()
  regmap_bulk_read(INT_STATUS_01..03)
  it6505_irq_scdt()
    it6505_calc_video_info()
pm_runtime_force_suspend()
  it6505_poweroff()
    disable_irq_nosync(it6505->irq)
    cancel_work_sync(&link_works)
    ...
    gpiod_set_value_cansleep(reset, 1)
                                      schedule_work(&link_works)
                                        <-- runs against powered-off chip
    regulator_disable(...)
    it6505->powered = false;

Since it6505->powered is cleared last, the requeued work can issue I2C
and DP AUX transactions while the chip is held in reset or powering
down, or leave hdcp_work pending across poweroff. Using disable_irq()
(or synchronize_irq() when called from outside the IRQ thread) before
canceling the work items would ensure the handler has finished.

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

Reply via email to