All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
To: "James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	<linux-scsi@vger.kernel.org>
Subject: [PATCH v3 2/3] scsi: sun3x_esp: add IRQ check
Date: Tue, 30 Mar 2021 20:44:08 +0300	[thread overview]
Message-ID: <363eb4c8-a3bf-4dc9-2a9e-90f349030a15@omprussia.ru> (raw)
In-Reply-To: <137b9e4d-391f-3163-2e6f-9e21aeb6bf34@omprussia.ru>

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 the real
error code.  Stop  calling request_irq() with the invalid IRQ #s.

Fixes: 0bb67f181834 ("[SCSI] sun3x_esp: convert to esp_scsi")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>

---
Changes in version 3:
- fixed up the patch summary.

Changes in version 2:
- clarified the description.

 drivers/scsi/sun3x_esp.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: scsi/drivers/scsi/sun3x_esp.c
===================================================================
--- scsi.orig/drivers/scsi/sun3x_esp.c
+++ scsi/drivers/scsi/sun3x_esp.c
@@ -206,7 +206,9 @@ static int esp_sun3x_probe(struct platfo
 	if (!esp->command_block)
 		goto fail_unmap_regs_dma;
 
-	host->irq = platform_get_irq(dev, 0);
+	host->irq = err = platform_get_irq(dev, 0);
+	if (err < 0)
+		goto fail_unmap_command_block;
 	err = request_irq(host->irq, scsi_esp_intr, IRQF_SHARED,
 			  "SUN3X ESP", esp);
 	if (err < 0)

  parent reply	other threads:[~2021-03-30 17:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30 17:40 [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
2021-03-30 17:41 ` [PATCH v3 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
2021-03-30 17:46   ` Sergey Shtylyov
2021-03-30 17:43 ` [PATCH v3 1/3] " Sergey Shtylyov
2021-03-30 17:44 ` Sergey Shtylyov [this message]
2021-03-30 17:45 ` [PATCH v3 3/3] scsi: sni_53c710: " Sergey Shtylyov
2021-04-16  2:51 ` [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Martin K. Petersen

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=363eb4c8-a3bf-4dc9-2a9e-90f349030a15@omprussia.ru \
    --to=s.shtylyov@omprussia.ru \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.