linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers
@ 2021-08-09 20:16 Sergey Shtylyov
  2021-08-09 20:21 ` [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:16 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi

Here are 9 patches against the 'usb-linus' branch of GregKH's 'usb.git' repo.
The affected drivers call platform_get_irq() but largely ignore its result --
they blithely pass the negative error codes to request_irq() (and its ilk)
which expects *unsinged* IRQ #s. Stop doing that by checking what exactly
platform_get_irq() returns.

[1/9] usb: dwc3: meson-g12a: add IRQ check
[2/9] usb: dwc3: qcom: add IRQ check
[3/6] usb: gadget: udc: at91: add IRQ check
[4/9] usb: gadget: udc: s3c2410: add IRQ check
[5/9] usb: host: ohci-tmio: add IRQ check
[6/9] usb: misc: brcmstb-usb-pinmap: add IRQ check
[7/9] usb: phy: fsl-usb: add IRQ check
[8/9] usb: phy: tahvo: add IRQ check
[9/9] usb: phy: twl6030: add IRQ checks

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

* [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
@ 2021-08-09 20:21 ` Sergey Shtylyov
  2021-08-09 20:23 ` [PATCH v2 2/9] usb: dwc3: qcom: " Sergey Shtylyov
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:21 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	linux-arm-kernel, linux-amlogic

The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_threaded_irq()
(which takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
an original error code. Stop calling devm_request_threaded_irq() with the
invalid IRQ #s.

Fixes: f90db10779ad ("usb: dwc3: meson-g12a: Add support for IRQ based OTG switching")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Felipe Balbi <balbi@kernel.org>

---
Changes in version 2:
- added Martin's and Felipe's tags.

drivers/usb/dwc3/dwc3-meson-g12a.c |    2 ++
 1 file changed, 2 insertions(+)

Index: usb/drivers/usb/dwc3/dwc3-meson-g12a.c
===================================================================
--- usb.orig/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ usb/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -598,6 +598,8 @@ static int dwc3_meson_g12a_otg_init(stru
 				   USB_R5_ID_DIG_IRQ, 0);
 
 		irq = platform_get_irq(pdev, 0);
+		if (irq < 0)
+			return irq;
 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 						dwc3_meson_g12a_irq_thread,
 						IRQF_ONESHOT, pdev->name, priv);

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

* [PATCH v2 2/9] usb: dwc3: qcom: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
  2021-08-09 20:21 ` [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
@ 2021-08-09 20:23 ` Sergey Shtylyov
  2021-08-09 20:27 ` [PATCH v2 3/6] usb: gadget: udc: at91: " Sergey Shtylyov
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:23 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Andy Gross, Bjorn Andersson, linux-arm-msm

In dwc3_qcom_acpi_register_core(), the driver neglects to check the result
of platform_get_irq()'s call and blithely assigns the negative error codes
to the allocated child device's IRQ resource and then passing this resource
to platform_device_add_resources() and later causing dwc3_otg_get_irq() to
fail anyway.  Stop calling platform_device_add_resources() with the invalid
IRQ #s, so that there's less complexity in the IRQ error checking.

Fixes: 2bc02355f8ba ("usb: dwc3: qcom: Add support for booting with ACPI")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Felipe Balbi <balbi@kernel.org>

---
Changes in version 2:
- added Felipe's ACK.


 drivers/usb/dwc3/dwc3-qcom.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: usb/drivers/usb/dwc3/dwc3-qcom.c
===================================================================
--- usb.orig/drivers/usb/dwc3/dwc3-qcom.c
+++ usb/drivers/usb/dwc3/dwc3-qcom.c
@@ -614,6 +614,10 @@ static int dwc3_qcom_acpi_register_core(
 		qcom->acpi_pdata->dwc3_core_base_size;
 
 	irq = platform_get_irq(pdev_irq, 0);
+	if (irq < 0) {
+		ret = irq;
+		goto out;
+	}
 	child_res[1].flags = IORESOURCE_IRQ;
 	child_res[1].start = child_res[1].end = irq;
 

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

* [PATCH v2 3/6] usb: gadget: udc: at91: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
  2021-08-09 20:21 ` [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
  2021-08-09 20:23 ` [PATCH v2 2/9] usb: dwc3: qcom: " Sergey Shtylyov
@ 2021-08-09 20:27 ` Sergey Shtylyov
  2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:27 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Nicolas Ferre, Alexandre Belloni, Ludovic Desroches, linux-arm-kernel

The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code. Stop calling devm_request_irq() with the invalid IRQ #s.

Fixes: 8b2e76687b39 ("USB: AT91 UDC updates, mostly power management")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

---
Changes in version 2:
- added Felipe's ACK.

drivers/usb/gadget/udc/at91_udc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: usb/drivers/usb/gadget/udc/at91_udc.c
===================================================================
--- usb.orig/drivers/usb/gadget/udc/at91_udc.c
+++ usb/drivers/usb/gadget/udc/at91_udc.c
@@ -1876,7 +1876,9 @@ static int at91udc_probe(struct platform
 	clk_disable(udc->iclk);
 
 	/* request UDC and maybe VBUS irqs */
-	udc->udp_irq = platform_get_irq(pdev, 0);
+	udc->udp_irq = retval = platform_get_irq(pdev, 0);
+	if (retval < 0)
+		goto err_unprepare_iclk;
 	retval = devm_request_irq(dev, udc->udp_irq, at91_udc_irq, 0,
 				  driver_name, udc);
 	if (retval) {

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

* [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (2 preceding siblings ...)
  2021-08-09 20:27 ` [PATCH v2 3/6] usb: gadget: udc: at91: " Sergey Shtylyov
@ 2021-08-09 20:35 ` Sergey Shtylyov
  2021-08-10  6:53   ` Krzysztof Kozlowski
  2021-08-12  5:40   ` Felipe Balbi
  2021-08-09 20:41 ` [PATCH v2 5/9] usb: host: ohci-tmio: " Sergey Shtylyov
                   ` (4 subsequent siblings)
  8 siblings, 2 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:35 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc

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: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/gadget/udc/s3c2410_udc.c |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Index: usb/drivers/usb/gadget/udc/s3c2410_udc.c
===================================================================
--- usb.orig/drivers/usb/gadget/udc/s3c2410_udc.c
+++ usb/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -1784,6 +1784,10 @@ static int s3c2410_udc_probe(struct plat
 	s3c2410_udc_reinit(udc);
 
 	irq_usbd = platform_get_irq(pdev, 0);
+	if (irq_usbd < 0) {
+		retval = irq_usbd;
+		goto err_udc_clk;
+	}
 
 	/* irq setup after old hardware state is cleaned up */
 	retval = request_irq(irq_usbd, s3c2410_udc_irq,

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

* [PATCH v2 5/9] usb: host: ohci-tmio: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (3 preceding siblings ...)
  2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
@ 2021-08-09 20:41 ` Sergey Shtylyov
  2021-08-09 20:54   ` Alan Stern
  2021-08-09 20:45 ` [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: " Sergey Shtylyov
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:41 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi, Alan Stern

The driver neglects to check the  result of platform_get_irq()'s call and
blithely passes the negative error codes to usb_add_hcd() (which takes
*unsigned* IRQ #), causing request_irq() that it calls to fail with
-EINVAL, overriding an original error code. Stop calling usb_add_hcd()
with the invalid IRQ #s.

Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/host/ohci-tmio.c |    2 ++
 1 file changed, 2 insertions(+)

Index: usb/drivers/usb/host/ohci-tmio.c
===================================================================
--- usb.orig/drivers/usb/host/ohci-tmio.c
+++ usb/drivers/usb/host/ohci-tmio.c
@@ -242,6 +242,8 @@ static int ohci_hcd_tmio_drv_probe(struc
 	if (ret < 0)
 		goto err_enable;
 
+	if (irq < 0)
+		goto err_enable;
 	ret = usb_add_hcd(hcd, irq, 0);
 	if (ret)
 		goto err_add_hcd;

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

* [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (4 preceding siblings ...)
  2021-08-09 20:41 ` [PATCH v2 5/9] usb: host: ohci-tmio: " Sergey Shtylyov
@ 2021-08-09 20:45 ` Sergey Shtylyov
  2021-08-10  9:51   ` Florian Fainelli
  2021-08-09 20:50 ` [PATCH v2 7/9] usb: phy: fsl-usb: " Sergey Shtylyov
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:45 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Al Cooper, Florian Fainelli, bcm-kernel-feedback-list, linux-arm-kernel

The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_irq() (which takes
*unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
error code.  Stop calling devm_request_irq() with the invalid IRQ #s.

Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/misc/brcmstb-usb-pinmap.c |    2 ++
 1 file changed, 2 insertions(+)

Index: usb/drivers/usb/misc/brcmstb-usb-pinmap.c
===================================================================
--- usb.orig/drivers/usb/misc/brcmstb-usb-pinmap.c
+++ usb/drivers/usb/misc/brcmstb-usb-pinmap.c
@@ -293,6 +293,8 @@ static int __init brcmstb_usb_pinmap_pro
 
 		/* Enable interrupt for out pins */
 		irq = platform_get_irq(pdev, 0);
+		if (irq < 0)
+			return irq;
 		err = devm_request_irq(&pdev->dev, irq,
 				       brcmstb_usb_pinmap_ovr_isr,
 				       IRQF_TRIGGER_RISING,

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

* [PATCH v2 7/9] usb: phy: fsl-usb: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (5 preceding siblings ...)
  2021-08-09 20:45 ` [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: " Sergey Shtylyov
@ 2021-08-09 20:50 ` Sergey Shtylyov
  2021-08-12  5:38   ` Felipe Balbi
  2021-08-09 20:52 ` [PATCH v2 8/9] usb: phy: tahvo: " Sergey Shtylyov
  2021-08-09 20:53 ` [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks Sergey Shtylyov
  8 siblings, 1 reply; 19+ 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] 19+ messages in thread

* [PATCH v2 8/9] usb: phy: tahvo: add IRQ check
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (6 preceding siblings ...)
  2021-08-09 20:50 ` [PATCH v2 7/9] usb: phy: fsl-usb: " Sergey Shtylyov
@ 2021-08-09 20:52 ` Sergey Shtylyov
  2021-08-12  5:39   ` Felipe Balbi
  2021-08-13  7:02   ` Greg Kroah-Hartman
  2021-08-09 20:53 ` [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks Sergey Shtylyov
  8 siblings, 2 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:52 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi

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] 19+ messages in thread

* [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks
  2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
                   ` (7 preceding siblings ...)
  2021-08-09 20:52 ` [PATCH v2 8/9] usb: phy: tahvo: " Sergey Shtylyov
@ 2021-08-09 20:53 ` Sergey Shtylyov
  2021-08-12  5:39   ` Felipe Balbi
  8 siblings, 1 reply; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-09 20:53 UTC (permalink / raw)
  To: linux-usb, Greg Kroah-Hartman, Felipe Balbi

The driver neglects to check the result of platform_get_irq()'s calls and
blithely passes the negative error codes to request_threaded_irq() (which
takes *unsigned* IRQ #), causing them both to fail with -EINVAL, overriding
an original error code.  Stop calling request_threaded_irq() with the
invalid IRQ #s.

Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

Index: usb/drivers/usb/phy/phy-twl6030-usb.c
===================================================================
--- usb.orig/drivers/usb/phy/phy-twl6030-usb.c
+++ usb/drivers/usb/phy/phy-twl6030-usb.c
@@ -348,6 +348,11 @@ static int twl6030_usb_probe(struct plat
 	twl->irq2		= platform_get_irq(pdev, 1);
 	twl->linkstat		= MUSB_UNKNOWN;
 
+	if (twl->irq1 < 0)
+		return twl->irq1;
+	if (twl->irq2 < 0)
+		return twl->irq2;
+
 	twl->comparator.set_vbus	= twl6030_set_vbus;
 	twl->comparator.start_srp	= twl6030_start_srp;
 

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

* Re: [PATCH v2 5/9] usb: host: ohci-tmio: add IRQ check
  2021-08-09 20:41 ` [PATCH v2 5/9] usb: host: ohci-tmio: " Sergey Shtylyov
@ 2021-08-09 20:54   ` Alan Stern
  0 siblings, 0 replies; 19+ messages in thread
From: Alan Stern @ 2021-08-09 20:54 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-usb, Greg Kroah-Hartman, Felipe Balbi

On Mon, Aug 09, 2021 at 11:41:59PM +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 usb_add_hcd() (which takes
> *unsigned* IRQ #), causing request_irq() that it calls to fail with
> -EINVAL, overriding an original error code. Stop calling usb_add_hcd()
> with the invalid IRQ #s.
> 
> Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
>  drivers/usb/host/ohci-tmio.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> Index: usb/drivers/usb/host/ohci-tmio.c
> ===================================================================
> --- usb.orig/drivers/usb/host/ohci-tmio.c
> +++ usb/drivers/usb/host/ohci-tmio.c
> @@ -242,6 +242,8 @@ static int ohci_hcd_tmio_drv_probe(struc
>  	if (ret < 0)
>  		goto err_enable;
>  
> +	if (irq < 0)
> +		goto err_enable;
>  	ret = usb_add_hcd(hcd, irq, 0);
>  	if (ret)
>  		goto err_add_hcd;

Surely this test should be placed near the start of the function, before 
the call to usb_create_hcd().  There's no point in doing all the extra 
work if the irq value is already invalid.

Alan Stern

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

* Re: [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
@ 2021-08-10  6:53   ` Krzysztof Kozlowski
  2021-08-12  5:40   ` Felipe Balbi
  1 sibling, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2021-08-10  6:53 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: linux-arm-kernel, linux-samsung-soc

On 09/08/2021 22:35, 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: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> 
> ---
>  drivers/usb/gadget/udc/s3c2410_udc.c |    4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 


Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>


Best regards,
Krzysztof

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

* Re: [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: add IRQ check
  2021-08-09 20:45 ` [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: " Sergey Shtylyov
@ 2021-08-10  9:51   ` Florian Fainelli
  0 siblings, 0 replies; 19+ messages in thread
From: Florian Fainelli @ 2021-08-10  9:51 UTC (permalink / raw)
  To: Sergey Shtylyov, linux-usb, Greg Kroah-Hartman, Felipe Balbi
  Cc: Al Cooper, bcm-kernel-feedback-list, linux-arm-kernel



On 8/9/2021 1:45 PM, Sergey Shtylyov wrote:
> The driver neglects to check the result of platform_get_irq()'s call and
> blithely passes the negative error codes to devm_request_irq() (which takes
> *unsigned* IRQ #), causing it to fail with -EINVAL, overriding an original
> error code.  Stop calling devm_request_irq() with the invalid IRQ #s.
> 
> Fixes: 517c4c44b323 ("usb: Add driver to allow any GPIO to be used for 7211 USB signals")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian

^ permalink raw reply	[flat|nested] 19+ 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: " Sergey Shtylyov
@ 2021-08-12  5:38   ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:38 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-usb, Greg Kroah-Hartman, Ran Wang, linuxppc-dev


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] 19+ messages in thread

* Re: [PATCH v2 8/9] usb: phy: tahvo: add IRQ check
  2021-08-09 20:52 ` [PATCH v2 8/9] usb: phy: tahvo: " Sergey Shtylyov
@ 2021-08-12  5:39   ` Felipe Balbi
  2021-08-13  7:02   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:39 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-usb, Greg Kroah-Hartman


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] 19+ messages in thread

* Re: [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks
  2021-08-09 20:53 ` [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks Sergey Shtylyov
@ 2021-08-12  5:39   ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:39 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-usb, Greg Kroah-Hartman


Sergey Shtylyov <s.shtylyov@omp.ru> writes:

> The driver neglects to check the result of platform_get_irq()'s calls and
> blithely passes the negative error codes to request_threaded_irq() (which
> takes *unsigned* IRQ #), causing them both to fail with -EINVAL, overriding
> an original error code.  Stop calling request_threaded_irq() with the
> invalid IRQ #s.
>
> Fixes: c33fad0c3748 ("usb: otg: Adding twl6030-usb transceiver driver for OMAP4430")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

-- 
balbi

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

* Re: [PATCH v2 4/9] usb: gadget: udc: s3c2410: add IRQ check
  2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
  2021-08-10  6:53   ` Krzysztof Kozlowski
@ 2021-08-12  5:40   ` Felipe Balbi
  1 sibling, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2021-08-12  5:40 UTC (permalink / raw)
  To: Sergey Shtylyov
  Cc: linux-usb, Greg Kroah-Hartman, Krzysztof Kozlowski,
	linux-arm-kernel, linux-samsung-soc


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: 188db4435ac6 ("usb: gadget: s3c: use platform resources")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

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

-- 
balbi

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

* Re: [PATCH v2 8/9] usb: phy: tahvo: add IRQ check
  2021-08-09 20:52 ` [PATCH v2 8/9] usb: phy: tahvo: " Sergey Shtylyov
  2021-08-12  5:39   ` Felipe Balbi
@ 2021-08-13  7:02   ` Greg Kroah-Hartman
  2021-08-13 10:33     ` Sergey Shtylyov
  1 sibling, 1 reply; 19+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-13  7:02 UTC (permalink / raw)
  To: Sergey Shtylyov; +Cc: linux-usb, Felipe Balbi

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 :(

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

* Re: [PATCH v2 8/9] usb: phy: tahvo: add IRQ check
  2021-08-13  7:02   ` Greg Kroah-Hartman
@ 2021-08-13 10:33     ` Sergey Shtylyov
  0 siblings, 0 replies; 19+ messages in thread
From: Sergey Shtylyov @ 2021-08-13 10:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-usb, Felipe Balbi

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

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

end of thread, other threads:[~2021-08-13 10:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 20:16 [PATCH v2 0/9] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers Sergey Shtylyov
2021-08-09 20:21 ` [PATCH v2 1/9] usb: dwc3: meson-g12a: add IRQ check Sergey Shtylyov
2021-08-09 20:23 ` [PATCH v2 2/9] usb: dwc3: qcom: " Sergey Shtylyov
2021-08-09 20:27 ` [PATCH v2 3/6] usb: gadget: udc: at91: " Sergey Shtylyov
2021-08-09 20:35 ` [PATCH v2 4/9] usb: gadget: udc: s3c2410: " Sergey Shtylyov
2021-08-10  6:53   ` Krzysztof Kozlowski
2021-08-12  5:40   ` Felipe Balbi
2021-08-09 20:41 ` [PATCH v2 5/9] usb: host: ohci-tmio: " Sergey Shtylyov
2021-08-09 20:54   ` Alan Stern
2021-08-09 20:45 ` [PATCH v2 6/9] usb: misc: brcmstb-usb-pinmap: " Sergey Shtylyov
2021-08-10  9:51   ` Florian Fainelli
2021-08-09 20:50 ` [PATCH v2 7/9] usb: phy: fsl-usb: " Sergey Shtylyov
2021-08-12  5:38   ` Felipe Balbi
2021-08-09 20:52 ` [PATCH v2 8/9] usb: phy: tahvo: " Sergey Shtylyov
2021-08-12  5:39   ` Felipe Balbi
2021-08-13  7:02   ` Greg Kroah-Hartman
2021-08-13 10:33     ` Sergey Shtylyov
2021-08-09 20:53 ` [PATCH v2 9/9] usb: phy: twl6030: add IRQ checks Sergey Shtylyov
2021-08-12  5:39   ` 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).