Thread (5 messages) 5 messages, 2 authors, 2021-11-02

Re: [PATCH v2 01/22] usb: host: ehci-exynos: deny IRQ0

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2021-10-30 08:55:47
Also in: linux-samsung-soc, linux-usb

On Tue, Oct 26, 2021 at 08:39:22PM +0300, Sergey Shtylyov wrote:
quoted hunk ↗ jump to hunk
If platform_get_irq() returns IRQ0 (considered invalid according to Linus)
the driver blithely passes it to usb_add_hcd() that treats IRQ0 as no IRQ
at all. Deny IRQ0 right away, returning -EINVAL from the probe() method...

Fixes: 44ed240d6273 ("usb: host: ehci-exynos: Fix error check in exynos_ehci_probe()")
Signed-off-by: Sergey Shtylyov <redacted>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
Changes in version 2:
- added Alan's ACK.

 drivers/usb/host/ehci-exynos.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 1a9b7572e17f..ff4e1261801a 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -207,6 +207,10 @@ static int exynos_ehci_probe(struct platform_device *pdev)
 		err = irq;
 		goto fail_io;
 	}
+	if (!irq) {
+		err = -EINVAL;
+		goto fail_io;
+	}
This is a huge sign that the api being used here is broken.

Please fix the root cause here, if returning a 0 is an error, then have
the function you called to get this irq return an error.  Otherwise you
will have to fix ALL callers, and people will always get it wrong.

Fix the root cause here, don't paper it over.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help