linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe()
@ 2023-08-26 10:02 Zhang Shurong
  2023-08-28 15:32 ` Helen Mae Koike Fornazier
  2023-09-12 11:38 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Shurong @ 2023-08-26 10:02 UTC (permalink / raw)
  To: ldewangan
  Cc: broonie, thierry.reding, jonathanh, p.zabel, sumit.semwal,
	christian.koenig, linux-spi, linux-tegra, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig, Zhang Shurong

This func misses checking for platform_get_irq()'s call and may passes the
negative error codes to request_irq(), which takes unsigned IRQ #,
causing it to fail with -EINVAL, overriding an original error code.

Fix this by stop calling request_irq() with invalid IRQ #s.

Fixes: dc4dc3605639 ("spi: tegra: add spi driver for SLINK controller")
Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
---
 drivers/spi/spi-tegra20-slink.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
index 4d6db6182c5e..f5cd365c913a 100644
--- a/drivers/spi/spi-tegra20-slink.c
+++ b/drivers/spi/spi-tegra20-slink.c
@@ -1086,6 +1086,8 @@ static int tegra_slink_probe(struct platform_device *pdev)
 	reset_control_deassert(tspi->rst);
 
 	spi_irq = platform_get_irq(pdev, 0);
+	if (spi_irq < 0)
+		return spi_irq;
 	tspi->irq = spi_irq;
 	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
 				   tegra_slink_isr_thread, IRQF_ONESHOT,
-- 
2.30.2


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

* Re: [PATCH] spi: tegra: Fix  missing IRQ check in tegra_slink_probe()
  2023-08-26 10:02 [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe() Zhang Shurong
@ 2023-08-28 15:32 ` Helen Mae Koike Fornazier
  2023-09-12 11:38 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Helen Mae Koike Fornazier @ 2023-08-28 15:32 UTC (permalink / raw)
  To: Zhang Shurong
  Cc: ldewangan, linux-spi, linux-kernel, dri-devel, sumit.semwal,
	linaro-mm-sig, broonie, thierry.reding, linux-tegra, jonathanh,
	christian.koenig, linux-media

On Saturday, August 26, 2023 07:02 -03, Zhang Shurong <zhang_shurong@foxmail.com> wrote:

> This func misses checking for platform_get_irq()'s call and may passes the
> negative error codes to request_irq(), which takes unsigned IRQ #,
> causing it to fail with -EINVAL, overriding an original error code.
> 
> Fix this by stop calling request_irq() with invalid IRQ #s.
> 
> Fixes: dc4dc3605639 ("spi: tegra: add spi driver for SLINK controller")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>

Reviewed-by: Helen Koike <helen.koike@collabora.com>

> ---
>  drivers/spi/spi-tegra20-slink.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c
> index 4d6db6182c5e..f5cd365c913a 100644
> --- a/drivers/spi/spi-tegra20-slink.c
> +++ b/drivers/spi/spi-tegra20-slink.c
> @@ -1086,6 +1086,8 @@ static int tegra_slink_probe(struct platform_device *pdev)
>  	reset_control_deassert(tspi->rst);
>  
>  	spi_irq = platform_get_irq(pdev, 0);
> +	if (spi_irq < 0)
> +		return spi_irq;
>  	tspi->irq = spi_irq;
>  	ret = request_threaded_irq(tspi->irq, tegra_slink_isr,
>  				   tegra_slink_isr_thread, IRQF_ONESHOT,
> -- 
> 2.30.2
>


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

* Re: [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe()
  2023-08-26 10:02 [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe() Zhang Shurong
  2023-08-28 15:32 ` Helen Mae Koike Fornazier
@ 2023-09-12 11:38 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2023-09-12 11:38 UTC (permalink / raw)
  To: ldewangan, Zhang Shurong
  Cc: thierry.reding, jonathanh, p.zabel, sumit.semwal,
	christian.koenig, linux-spi, linux-tegra, linux-kernel,
	linux-media, dri-devel, linaro-mm-sig

On Sat, 26 Aug 2023 18:02:54 +0800, Zhang Shurong wrote:
> This func misses checking for platform_get_irq()'s call and may passes the
> negative error codes to request_irq(), which takes unsigned IRQ #,
> causing it to fail with -EINVAL, overriding an original error code.
> 
> Fix this by stop calling request_irq() with invalid IRQ #s.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] spi: tegra: Fix missing IRQ check in tegra_slink_probe()
      commit: eb9913b511f10968a02cfa5329a896855dd152a3

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] 3+ messages in thread

end of thread, other threads:[~2023-09-12 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-26 10:02 [PATCH] spi: tegra: Fix missing IRQ check in tegra_slink_probe() Zhang Shurong
2023-08-28 15:32 ` Helen Mae Koike Fornazier
2023-09-12 11:38 ` 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).