linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: <linux-usb@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Felipe Balbi <balbi@kernel.org>
Subject: [PATCH v3 2/2] usb: phy: tahvo: add IRQ check
Date: Fri, 13 Aug 2021 23:32:38 +0300	[thread overview]
Message-ID: <8280d6a4-8e9a-7cfe-1aa9-db586dc9afdf@omp.ru> (raw)
In-Reply-To: <fb92857f-3120-9a20-65ba-f21aeb4b9020@omp.ru>

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

Fixes: 9ba96ae5074c ("usb: omap1: Tahvo USB transceiver driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
 drivers/usb/phy/phy-tahvo.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: usb/drivers/usb/phy/phy-tahvo.c
===================================================================
--- usb.orig/drivers/usb/phy/phy-tahvo.c
+++ usb/drivers/usb/phy/phy-tahvo.c
@@ -393,7 +393,9 @@ static int tahvo_usb_probe(struct platfo
 
 	dev_set_drvdata(&pdev->dev, tu);
 
-	tu->irq = platform_get_irq(pdev, 0);
+	tu->irq = ret = platform_get_irq(pdev, 0);
+	if (ret < 0)
+		return ret;
 	ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
 				   IRQF_ONESHOT,
 				   "tahvo-vbus", tu);

  parent reply	other threads:[~2021-08-13 20:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 20:23 [PATCH v3 0/2] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers` Sergey Shtylyov
2021-08-13 20:30 ` [PATCH v3 1/2] usb: host: ohci-tmio: add IRQ check Sergey Shtylyov
2021-08-14  1:45   ` Alan Stern
2021-08-13 20:32 ` Sergey Shtylyov [this message]
2021-08-14 11:28   ` [PATCH v3 2/2] usb: phy: tahvo: " Felipe Balbi
2021-08-14  6:39 ` [PATCH v3 0/2] Stop calling request_irq(), etc. with invalid IRQs in the USB drivers` Greg Kroah-Hartman
2021-08-14 11:59   ` Sergey Shtylyov
2021-08-14 13:34     ` Greg Kroah-Hartman
2021-08-14 18:16       ` Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8280d6a4-8e9a-7cfe-1aa9-db586dc9afdf@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).