# Re: \[PATCH v5 3/7\] phy: cpcap-usb: fix IRQ teardown race

- From: Manivannan Sadhasivam \<mani@kernel.org\>
- Date: 2026-09-09 15:32:18 
- List: linux-devicetree
- Page: https://ratatoskr.run/linux-devicetree/2026/09/17540559

```text
On Sat, Jul 11, 2026 at 11:42:06PM +0300, Ivaylo Dimitrov wrote:
> there is a race between IRQ handler and remove:
> 
> IRQ thread:
>     ddata->active == 1
> 
> remove():
>     ddata->active = 0
>     cancel_delayed_work_sync()
> 
> IRQ thread:
>     schedule_delayed_work()
> 
> The IRQ handler can therefore queue detect work after it has been canceled
> during remove(). Free the IRQ handlers before canceling detect work to
> prevent new work from being scheduled during teardown.
> 
> Reported by Sashiko

Add a proper tag.

> 
> Signed-off-by: Ivaylo Dimitrov <redacted>
> ---
>  drivers/phy/motorola/phy-cpcap-usb.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c
> index 7cb020dd3423..741145c89e5b 100644
> --- a/drivers/phy/motorola/phy-cpcap-usb.c
> +++ b/drivers/phy/motorola/phy-cpcap-usb.c
> @@ -393,6 +393,19 @@ static int cpcap_usb_init_interrupts(struct platform_device *pdev,
>  	return 0;
>  }
>  
> +static void cpcap_usb_fini_interrupts(struct platform_device *pdev,

s/fini/free

- Mani

-- 
மணிவண்ணன் சதாசிவம்
```
