* [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers
@ 2021-04-10 20:11 Sergey Shtylyov
2021-04-10 20:14 ` [PATCH v2 1/6] i2c: cadence: add IRQ check Sergey Shtylyov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-04-10 20:11 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang, Khalil Blaiech, Paul Cercueil,
Michal Simek
Cc: linux-mips, linux-arm-kernel
Here are 6 patches against the 'master' branch of Martin Petersen's 'scsi.git' repo.
The affected drivers call platform_get_irq() but largely ignore its result -- they
blithely pass the negative error codes to devm_request_irq() which expects *unsinged*
IRQ #s. Stop doing that by checking what exactly platform_get_irq() returns.
[1/6] i2c: cadence: add IRQ check
[2/6] i2c: emev2: add IRQ check
[3/6] i2c: jz4780: add IRQ check
[4/6] i2c: mlxbf: add IRQ check
[5/6] i2c: rcar: add IRQ check
[6/6] i2c: sh7760: add IRQ check
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/6] i2c: cadence: add IRQ check
2021-04-10 20:11 [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
@ 2021-04-10 20:14 ` Sergey Shtylyov
2021-04-10 20:31 ` [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-04-10 20:14 UTC (permalink / raw)
To: linux-i2c, Michal Simek; +Cc: linux-arm-kernel
The driver neglects to check the result of platform_get_irq()'s call and
blithely passes the negative error codes to devm_request_irq() (which
takes *unsigned* IRQ #), causing it to fail with -EINVAL, overriding
an original error code. Stop calling devm_request_irq() with invalid
IRQ #s.
Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
---
Changes in version 2:
- new patch.
drivers/i2c/busses/i2c-cadence.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux/drivers/i2c/busses/i2c-cadence.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-cadence.c
+++ linux/drivers/i2c/busses/i2c-cadence.c
@@ -1200,7 +1200,10 @@ static int cdns_i2c_probe(struct platfor
if (IS_ERR(id->membase))
return PTR_ERR(id->membase);
- id->irq = platform_get_irq(pdev, 0);
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0)
+ return ret;
+ id->irq = ret;
id->adap.owner = THIS_MODULE;
id->adap.dev.of_node = pdev->dev.of_node;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers
2021-04-10 20:11 [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
2021-04-10 20:14 ` [PATCH v2 1/6] i2c: cadence: add IRQ check Sergey Shtylyov
@ 2021-04-10 20:31 ` Sergey Shtylyov
2021-04-10 20:57 ` Sergey Shtylyov
2021-04-14 8:22 ` Wolfram Sang
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-04-10 20:31 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang, Khalil Blaiech, Paul Cercueil,
Michal Simek
Cc: linux-mips, linux-arm-kernel
On 4/10/21 11:11 PM, Sergey Shtylyov wrote:
> Here are 6 patches against the 'master' branch of Martin Petersen's 'scsi.git' repo.
> The affected drivers call platform_get_irq() but largely ignore its result -- they
> blithely pass the negative error codes to devm_request_irq() which expects *unsinged*
> IRQ #s. Stop doing that by checking what exactly platform_get_irq() returns.
>
> [1/6] i2c: cadence: add IRQ check
> [2/6] i2c: emev2: add IRQ check
> [3/6] i2c: jz4780: add IRQ check
> [4/6] i2c: mlxbf: add IRQ check
> [5/6] i2c: rcar: add IRQ check
Forgot to mention that the whole v2 patch set grew from this R-Car patch.
> [6/6] i2c: sh7760: add IRQ check
MBR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers
2021-04-10 20:11 [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
2021-04-10 20:14 ` [PATCH v2 1/6] i2c: cadence: add IRQ check Sergey Shtylyov
2021-04-10 20:31 ` [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
@ 2021-04-10 20:57 ` Sergey Shtylyov
2021-04-14 8:22 ` Wolfram Sang
3 siblings, 0 replies; 5+ messages in thread
From: Sergey Shtylyov @ 2021-04-10 20:57 UTC (permalink / raw)
To: linux-i2c, Wolfram Sang, Khalil Blaiech, Paul Cercueil,
Michal Simek
Cc: linux-mips, linux-arm-kernel
On 4/10/21 11:11 PM, Sergey Shtylyov wrote:
> Here are 6 patches against the 'master' branch of Martin Petersen's 'scsi.git' repo.
Oops, left that line unfinished. Wolfram's 'linux.git' repo, of course... :-)
> The affected drivers call platform_get_irq() but largely ignore its result -- they
> blithely pass the negative error codes to devm_request_irq() which expects *unsinged*
> IRQ #s. Stop doing that by checking what exactly platform_get_irq() returns.
[...]
MNR, Sergey
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers
2021-04-10 20:11 [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
` (2 preceding siblings ...)
2021-04-10 20:57 ` Sergey Shtylyov
@ 2021-04-14 8:22 ` Wolfram Sang
3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2021-04-14 8:22 UTC (permalink / raw)
To: Sergey Shtylyov
Cc: linux-i2c, Khalil Blaiech, Paul Cercueil, Michal Simek,
linux-mips, linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 660 bytes --]
On Sat, Apr 10, 2021 at 11:11:59PM +0300, Sergey Shtylyov wrote:
> Here are 6 patches against the 'master' branch of Martin Petersen's 'scsi.git' repo.
> The affected drivers call platform_get_irq() but largely ignore its result -- they
> blithely pass the negative error codes to devm_request_irq() which expects *unsinged*
> IRQ #s. Stop doing that by checking what exactly platform_get_irq() returns.
>
> [1/6] i2c: cadence: add IRQ check
> [2/6] i2c: emev2: add IRQ check
> [3/6] i2c: jz4780: add IRQ check
> [4/6] i2c: mlxbf: add IRQ check
> [5/6] i2c: rcar: add IRQ check
> [6/6] i2c: sh7760: add IRQ check
Applied to for-next, thanks!
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-04-14 8:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-10 20:11 [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
2021-04-10 20:14 ` [PATCH v2 1/6] i2c: cadence: add IRQ check Sergey Shtylyov
2021-04-10 20:31 ` [PATCH v2 0/6] Stop calling devm_request_irq() with invalid IRQs in the I2C bus drivers Sergey Shtylyov
2021-04-10 20:57 ` Sergey Shtylyov
2021-04-14 8:22 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox