* [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs
@ 2021-03-29 20:15 Sergey Shtylyov
2021-03-29 20:16 ` [PATCH v2 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-03-29 20:15 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,
2 of them were previously posted separately, the 3rd is a new addition.
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 platfrom_get_irq() returns.
[1/3: scsi: jazz_esp: add IRQ check
[2/3] scsi: sun3x_esp: fix IRQ check
[3/3] scsi: sni_53c710: fix IRQ check
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3: scsi: jazz_esp: add IRQ check
2021-03-29 20:15 [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
@ 2021-03-29 20:16 ` Sergey Shtylyov
2021-03-29 20:18 ` [PATCH v2 2/3] scsi: sun3x_esp: fix " Sergey Shtylyov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-03-29 20:16 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] 5+ messages in thread
* [PATCH v2 2/3] scsi: sun3x_esp: fix IRQ check
2021-03-29 20:15 [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
2021-03-29 20:16 ` [PATCH v2 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
@ 2021-03-29 20:18 ` Sergey Shtylyov
2021-03-29 20:19 ` [PATCH v2 3/3] scsi: sni_53c710: " Sergey Shtylyov
2021-03-30 17:07 ` [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-03-29 20:18 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 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] 5+ messages in thread
* [PATCH v2 3/3] scsi: sni_53c710: fix IRQ check
2021-03-29 20:15 [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
2021-03-29 20:16 ` [PATCH v2 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
2021-03-29 20:18 ` [PATCH v2 2/3] scsi: sun3x_esp: fix " Sergey Shtylyov
@ 2021-03-29 20:19 ` Sergey Shtylyov
2021-03-30 17:07 ` [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-03-29 20:19 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 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] 5+ messages in thread
* Re: [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs
2021-03-29 20:15 [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
` (2 preceding siblings ...)
2021-03-29 20:19 ` [PATCH v2 3/3] scsi: sni_53c710: " Sergey Shtylyov
@ 2021-03-30 17:07 ` Sergey Shtylyov
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-03-30 17:07 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi
On 3/29/21 11:15 PM, Sergey Shtylyov wrote:
> Here are 3 patches against the 'fixes' branch of Martin Petersen's 'scsi.git' repo,
> 2 of them were previously posted separately, the 3rd is a new addition.
>
> 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 platfrom_get_irq() returns.
>
> [1/3: scsi: jazz_esp: add IRQ check
> [2/3] scsi: sun3x_esp: fix IRQ check
> [3/3] scsi: sni_53c710: fix IRQ check
Oops, the above 2 patches got misnamed. I'll recast and repost...
MBR, Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-30 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 20:15 [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
2021-03-29 20:16 ` [PATCH v2 1/3: scsi: jazz_esp: add IRQ check Sergey Shtylyov
2021-03-29 20:18 ` [PATCH v2 2/3] scsi: sun3x_esp: fix " Sergey Shtylyov
2021-03-29 20:19 ` [PATCH v2 3/3] scsi: sni_53c710: " Sergey Shtylyov
2021-03-30 17:07 ` [PATCH v2 0/3] Stop calling request_irq() with invalid IRQs Sergey Shtylyov
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.