linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check
       [not found] <47bacc02-4e34-3208-779c-7072a6261782@omp.ru>
@ 2021-08-09 20:50 ` Sergey Shtylyov
  2021-08-12  5:38   ` Felipe Balbi
  0 siblings, 1 reply; 2+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:50 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi, Ran Wang; +Cc: linuxppc-dev

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(+)

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) {

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check
  2021-08-09 20:50 ` [PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check Sergey Shtylyov
@ 2021-08-12  5:38   ` Felipe Balbi
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:38 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: Greg Kroah-Hartman, linux-usb, linuxppc-dev, Ran Wang


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-12  5:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <47bacc02-4e34-3208-779c-7072a6261782@omp.ru>
2021-08-09 20:50 ` [PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check Sergey Shtylyov
2021-08-12  5:38   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).