Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: renesas_usbhs: fix use-after-free in ISR during device removal

In usbhs_remove(), the driver frees resources (including the pipe array)
while the interrupt handler (usbhs_interrupt) is still registered. If an
interrupt fires after usbhs_pipe_remove() but before the driver is fully
unbound, the ISR may access freed memory, causing a use-after-free.

Fix this by calling devm_free_irq() before freeing resources. This ensures
the interrupt handler is both disabled and synchronized (waits for any
running ISR to complete) before usbhs_pipe_remove() is called.

Fixes: f1407d5c6624 ("usb: renesas_usbhs: Add Renesas USBHS common code")
Cc: stable <stable@kernel.org>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Fan Wu <fanwu01@zju.edu.cn>
Link: https://patch.msgid.link/20260303073344.34577-1-fanwu01@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Fan Wu and committed by
Greg Kroah-Hartman
3cbc242b 14ae24cb

+9
+9
drivers/usb/renesas_usbhs/common.c
··· 815 815 816 816 usbhs_platform_call(priv, hardware_exit, pdev); 817 817 reset_control_assert(priv->rsts); 818 + 819 + /* 820 + * Explicitly free the IRQ to ensure the interrupt handler is 821 + * disabled and synchronized before freeing resources. 822 + * devm_free_irq() calls free_irq() which waits for any running 823 + * ISR to complete, preventing UAF. 824 + */ 825 + devm_free_irq(&pdev->dev, priv->irq, priv); 826 + 818 827 usbhs_mod_remove(priv); 819 828 usbhs_fifo_remove(priv); 820 829 usbhs_pipe_remove(priv);