linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: meson-spicc: add IRQ check in meson_spicc_probe
@ 2022-01-26 11:04 Miaoqian Lin
  2022-01-26 15:36 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-01-26 11:04 UTC (permalink / raw)
  To: Mark Brown, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-spi, linux-arm-kernel, linux-amlogic,
	linux-kernel
  Cc: linmq006

This check misses checking for  platform_get_irq()'s call and may 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: 454fa271bc4e ("spi: Add Meson SPICC driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/spi/spi-meson-spicc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index c208efeadd18..0bc7daa7afc8 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -693,6 +693,11 @@ static int meson_spicc_probe(struct platform_device *pdev)
 	writel_relaxed(0, spicc->base + SPICC_INTREG);
 
 	irq = platform_get_irq(pdev, 0);
+	if (irq < 0) {
+		ret = irq;
+		goto out_master;
+	}
+
 	ret = devm_request_irq(&pdev->dev, irq, meson_spicc_irq,
 			       0, NULL, spicc);
 	if (ret) {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: meson-spicc: add IRQ check in meson_spicc_probe
  2022-01-26 11:04 [PATCH] spi: meson-spicc: add IRQ check in meson_spicc_probe Miaoqian Lin
@ 2022-01-26 15:36 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-01-26 15:36 UTC (permalink / raw)
  To: linux-spi, Neil Armstrong, Martin Blumenstingl, Miaoqian Lin,
	linux-kernel, Kevin Hilman, linux-arm-kernel, linux-amlogic,
	Jerome Brunet

On Wed, 26 Jan 2022 11:04:47 +0000, Miaoqian Lin wrote:
> This check misses checking for  platform_get_irq()'s call and may 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.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-linus

Thanks!

[1/1] spi: meson-spicc: add IRQ check in meson_spicc_probe
      commit: e937440f7fc444a3e3f1fb75ea65292d6f433a44

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-26 15:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 11:04 [PATCH] spi: meson-spicc: add IRQ check in meson_spicc_probe Miaoqian Lin
2022-01-26 15:36 ` Mark Brown

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).