diff mbox series

[v2,8/9] usb: phy: tahvo: add IRQ check

Message ID 71d33de9-ffee-705d-843a-dfc1b1c0bbc6@omp.ru
State New
Headers show
Series Stop calling request_irq(), etc. with invalid IRQs in the USB drivers | expand

Commit Message

Sergey Shtylyov Aug. 9, 2021, 8:52 p.m. UTC
The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code. Stop calling request_irq() with the invalid IRQ #s.

Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/phy/phy-fsl-usb.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Felipe Balbi Aug. 12, 2021, 5:39 a.m. UTC | #1
Sergey Shtylyov <s.shtylyov@omp.ru> writes:

> The driver neglects to check the result of platform_get_irq()'s call and

> blithely passes the negative error codes to request_irq() (which takes

> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original

> error code. Stop calling request_irq() with the invalid IRQ #s.

>

> Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")

> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>


Acked-by: Felipe Balbi <balbi@kernel.org>



-- 
balbi
Greg KH Aug. 13, 2021, 7:02 a.m. UTC | #2
On Mon, Aug 09, 2021 at 11:52:05PM +0300, Sergey Shtylyov wrote:
> The driver neglects to check the result of platform_get_irq()'s call and

> blithely passes the negative error codes to request_irq() (which takes

> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original

> error code. Stop calling request_irq() with the invalid IRQ #s.

> 

> Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")

> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

> 

> ---

>  drivers/usb/phy/phy-fsl-usb.c |    2 ++

>  1 file changed, 2 insertions(+)


This patch did not apply to my tree :(
Sergey Shtylyov Aug. 13, 2021, 10:33 a.m. UTC | #3
On 13.08.2021 10:02, Greg Kroah-Hartman wrote:
> On Mon, Aug 09, 2021 at 11:52:05PM +0300, Sergey Shtylyov wrote:

>> The driver neglects to check the result of platform_get_irq()'s call and

>> blithely passes the negative error codes to request_irq() (which takes

>> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original

>> error code. Stop calling request_irq() with the invalid IRQ #s.

>>

>> Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")

>> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

>>

>> ---

>>   drivers/usb/phy/phy-fsl-usb.c |    2 ++

>>   1 file changed, 2 insertions(+)

> 

> This patch did not apply to my tree :(


    No wonder -- I managed to send the FSL PHY patch twice. Sorry about all 
the mess! :-/

MBR, Sergei
diff mbox series

Patch

Index: usb/drivers/usb/phy/phy-fsl-usb.c
===================================================================
--- usb.orig/drivers/usb/phy/phy-fsl-usb.c
+++ usb/drivers/usb/phy/phy-fsl-usb.c
@@ -873,6 +873,8 @@  int usb_otg_start(struct platform_device
 
 	/* request irq */
 	p_otg->irq = platform_get_irq(pdev, 0);
+	if (p_otg->irq < 0)
+		return p_otg->irq;
 	status = request_irq(p_otg->irq, fsl_otg_isr,
 				IRQF_SHARED, driver_name, p_otg);
 	if (status) {