* [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs
@ 2021-03-30 17:40 Sergey Shtylyov
2021-03-30 17:41 ` [PATCH v3 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:40 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
Here are 3 patches against the 'fixes' branch of Martin Petersen's 'scsi.git' repo.
The affected drivers call platform_get_irq() but ignore its result -- they blithely
pass the negative error codes to request_irq() which expects *unsinged* IRQ #s. Stop
doing that by checking what platform_get_irq() returns.
[1/3: scsi: jazz_esp: add IRQ check
[2/3] scsi: sun3x_esp: add IRQ check
[3/3] scsi: sni_53c710: add IRQ check
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3: scsi: jazz_esp: add IRQ check
2021-03-30 17:40 [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
@ 2021-03-30 17:41 ` Sergey Shtylyov
2021-03-30 17:46 ` Sergey Shtylyov
2021-03-30 17:43 ` [PATCH v3 1/3] " Sergey Shtylyov
` (3 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:41 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
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: 352e921f0dd4 ("[SCSI] jazz_esp: converted to use esp_core")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
---
Changes in version 2:
- clarified the description.
drivers/scsi/jazz_esp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: scsi/drivers/scsi/jazz_esp.c
===================================================================
--- scsi.orig/drivers/scsi/jazz_esp.c
+++ scsi/drivers/scsi/jazz_esp.c
@@ -143,7 +143,9 @@ static int esp_jazz_probe(struct platfor
if (!esp->command_block)
goto fail_unmap_regs;
- 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, "ESP", esp);
if (err < 0)
goto fail_unmap_command_block;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] scsi: jazz_esp: add IRQ check
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:43 ` Sergey Shtylyov
2021-03-30 17:44 ` [PATCH v3 2/3] scsi: sun3x_esp: " Sergey Shtylyov
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:43 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
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: 352e921f0dd4 ("[SCSI] jazz_esp: converted to use esp_core")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
---
Changes in version 2:
- clarified the description.
drivers/scsi/jazz_esp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: scsi/drivers/scsi/jazz_esp.c
===================================================================
--- scsi.orig/drivers/scsi/jazz_esp.c
+++ scsi/drivers/scsi/jazz_esp.c
@@ -143,7 +143,9 @@ static int esp_jazz_probe(struct platfor
if (!esp->command_block)
goto fail_unmap_regs;
- 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, "ESP", esp);
if (err < 0)
goto fail_unmap_command_block;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] scsi: sun3x_esp: add IRQ check
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:43 ` [PATCH v3 1/3] " Sergey Shtylyov
@ 2021-03-30 17:44 ` Sergey Shtylyov
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
4 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:44 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
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)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] scsi: sni_53c710: add IRQ check
2021-03-30 17:40 [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
` (2 preceding siblings ...)
2021-03-30 17:44 ` [PATCH v3 2/3] scsi: sun3x_esp: " Sergey Shtylyov
@ 2021-03-30 17:45 ` Sergey Shtylyov
2021-04-16 2:51 ` [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Martin K. Petersen
4 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:45 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
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 #s), causing it to fail with -EINVAL (overridden by -ENODEV
further below). Stop calling request_irq() with the invalid IRQ #s.
Fixes: c27d85f3f3c5 ("[SCSI] SNI RM 53c710 driver")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
---
Changes in version 3:
- fixed up the patch summary.
Changes in version 2:
- new patch.
drivers/scsi/sni_53c710.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: scsi/drivers/scsi/sni_53c710.c
===================================================================
--- scsi.orig/drivers/scsi/sni_53c710.c
+++ scsi/drivers/scsi/sni_53c710.c
@@ -58,6 +58,7 @@ static int snirm710_probe(struct platfor
struct NCR_700_Host_Parameters *hostdata;
struct Scsi_Host *host;
struct resource *res;
+ int rc;
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res)
@@ -83,7 +84,9 @@ static int snirm710_probe(struct platfor
goto out_kfree;
host->this_id = 7;
host->base = base;
- host->irq = platform_get_irq(dev, 0);
+ host->irq = rc = platform_get_irq(dev, 0);
+ if (rc < 0)
+ goto out_put_host;
if(request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "snirm710", host)) {
printk(KERN_ERR "snirm710: request_irq failed!\n");
goto out_put_host;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/3: scsi: jazz_esp: add IRQ check
2021-03-30 17:41 ` [PATCH v3 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
@ 2021-03-30 17:46 ` Sergey Shtylyov
0 siblings, 0 replies; 7+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:46 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
Ignore this message -- I've lost ] in the subject. :-/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs
2021-03-30 17:40 [PATCH v3 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
` (3 preceding siblings ...)
2021-03-30 17:45 ` [PATCH v3 3/3] scsi: sni_53c710: " Sergey Shtylyov
@ 2021-04-16 2:51 ` Martin K. Petersen
4 siblings, 0 replies; 7+ messages in thread
From: Martin K. Petersen @ 2021-04-16 2:51 UTC (permalink / raw)
To: James E.J. Bottomley, Sergey Shtylyov, linux-scsi; +Cc: Martin K . Petersen
On Tue, 30 Mar 2021 20:40:35 +0300, Sergey Shtylyov wrote:
> Here are 3 patches against the 'fixes' branch of Martin Petersen's 'scsi.git' repo.
> The affected drivers call platform_get_irq() but ignore its result -- they blithely
> pass the negative error codes to request_irq() which expects *unsinged* IRQ #s. Stop
> doing that by checking what platform_get_irq() returns.
>
> [1/3: scsi: jazz_esp: add IRQ check
> [2/3] scsi: sun3x_esp: add IRQ check
> [3/3] scsi: sni_53c710: add IRQ check
Applied to 5.13/scsi-queue, thanks!
[1/3] scsi: jazz_esp: add IRQ check
https://git.kernel.org/mkp/scsi/c/38fca15c29db
[2/3] scsi: sun3x_esp: add IRQ check
https://git.kernel.org/mkp/scsi/c/14b321380eb3
[3/3] scsi: sni_53c710: add IRQ check
https://git.kernel.org/mkp/scsi/c/1160d61bc51e
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-04-16 2:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3 2/3] scsi: sun3x_esp: " Sergey Shtylyov
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
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.