public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] spi: meson-spicc: Fix double-put in remove path
@ 2026-03-22 13:29 Felix Gu
  2026-03-22 15:40 ` Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Felix Gu @ 2026-03-22 13:29 UTC (permalink / raw)
  To: Mark Brown, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Dongliang Mu
  Cc: linux-spi, linux-arm-kernel, linux-amlogic, linux-kernel,
	Felix Gu

meson_spicc_probe() registers the controller with
devm_spi_register_controller(), so teardown already drops the
controller reference via devm cleanup.

Calling spi_controller_put() again in meson_spicc_remove()
causes a double-put.

Fixes: 8311ee2164c5 ("spi: meson-spicc: fix memory leak in meson_spicc_remove")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/spi/spi-meson-spicc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c
index a7001b9e36e6..57768da3205d 100644
--- a/drivers/spi/spi-meson-spicc.c
+++ b/drivers/spi/spi-meson-spicc.c
@@ -1101,8 +1101,6 @@ static void meson_spicc_remove(struct platform_device *pdev)
 
 	/* Disable SPI */
 	writel(0, spicc->base + SPICC_CONREG);
-
-	spi_controller_put(spicc->host);
 }
 
 static const struct meson_spicc_data meson_spicc_gx_data = {

---
base-commit: 785f0eb2f85decbe7c1ef9ae922931f0194ffc2e
change-id: 20260322-rockchip-2a6021826137

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>



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

* Re: [PATCH] spi: meson-spicc: Fix double-put in remove path
  2026-03-22 13:29 [PATCH] spi: meson-spicc: Fix double-put in remove path Felix Gu
@ 2026-03-22 15:40 ` Markus Elfring
  2026-03-23 10:55 ` Johan Hovold
  2026-03-23 18:32 ` [PATCH] " Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Markus Elfring @ 2026-03-22 15:40 UTC (permalink / raw)
  To: Felix Gu, linux-spi, linux-amlogic, linux-arm-kernel
  Cc: LKML, Dongliang Mu, Jerome Brunet, Kevin Hilman, Mark Brown,
	Martin Blumenstingl, Neil Armstrong

> meson_spicc_probe() registers the controller with
> devm_spi_register_controller(), so teardown already drops the
> controller reference via devm cleanup.

Were any source code analysis tools involved here?


> Calling spi_controller_put() again in meson_spicc_remove()
> causes a double-put.

Do any contributors care more for another development requirement?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.0-rc4#n94

Regards,
Markus


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

* Re: [PATCH] spi: meson-spicc: Fix double-put in remove path
  2026-03-22 13:29 [PATCH] spi: meson-spicc: Fix double-put in remove path Felix Gu
  2026-03-22 15:40 ` Markus Elfring
@ 2026-03-23 10:55 ` Johan Hovold
  2026-03-23 11:33   ` Felix Gu
  2026-03-23 18:32 ` [PATCH] " Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Johan Hovold @ 2026-03-23 10:55 UTC (permalink / raw)
  To: Felix Gu
  Cc: Mark Brown, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Dongliang Mu, linux-spi, linux-arm-kernel,
	linux-amlogic, linux-kernel

On Sun, Mar 22, 2026 at 09:29:56PM +0800, Felix Gu wrote:
> meson_spicc_probe() registers the controller with
> devm_spi_register_controller(), so teardown already drops the
> controller reference via devm cleanup.
> 
> Calling spi_controller_put() again in meson_spicc_remove()
> causes a double-put.

Indeed it does: 

Reviewed-by: Johan Hovold <johan@kernel.org>

> Fixes: 8311ee2164c5 ("spi: meson-spicc: fix memory leak in meson_spicc_remove")

While only root can trigger this it should probably still go stable:

Cc: stable@vger.kernel.org

> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

How did you find this one? Are you using some kind of static analysis
tool or LLM?

Johan


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

* Re: [PATCH] spi: meson-spicc: Fix double-put in remove path
  2026-03-23 10:55 ` Johan Hovold
@ 2026-03-23 11:33   ` Felix Gu
  2026-03-23 18:44     ` Markus Elfring
  0 siblings, 1 reply; 7+ messages in thread
From: Felix Gu @ 2026-03-23 11:33 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Mark Brown, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Dongliang Mu, linux-spi, linux-arm-kernel,
	linux-amlogic, linux-kernel

> Indeed it does:
>
> Reviewed-by: Johan Hovold <johan@kernel.org>
>
> > Fixes: 8311ee2164c5 ("spi: meson-spicc: fix memory leak in meson_spicc_remove")
>
> While only root can trigger this it should probably still go stable:
>
> Cc: stable@vger.kernel.org
>
> > Signed-off-by: Felix Gu <ustc.gu@gmail.com>
>
> How did you find this one? Are you using some kind of static analysis
> tool or LLM?
>
> Johan
Hi Johan,
Just code review, I have fixed a similar one before.

Best regards,
Felix


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

* Re: [PATCH] spi: meson-spicc: Fix double-put in remove path
  2026-03-22 13:29 [PATCH] spi: meson-spicc: Fix double-put in remove path Felix Gu
  2026-03-22 15:40 ` Markus Elfring
  2026-03-23 10:55 ` Johan Hovold
@ 2026-03-23 18:32 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-03-23 18:32 UTC (permalink / raw)
  To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Dongliang Mu, Felix Gu
  Cc: linux-spi, linux-arm-kernel, linux-amlogic, linux-kernel

On Sun, 22 Mar 2026 21:29:56 +0800, Felix Gu wrote:
> spi: meson-spicc: Fix double-put in remove path

Applied to

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

Thanks!

[1/1] spi: meson-spicc: Fix double-put in remove path
      https://git.kernel.org/broonie/spi/c/63542bb402b7

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

* Re: spi: meson-spicc: Fix double-put in remove path
  2026-03-23 11:33   ` Felix Gu
@ 2026-03-23 18:44     ` Markus Elfring
  2026-03-23 18:47       ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Markus Elfring @ 2026-03-23 18:44 UTC (permalink / raw)
  To: Felix Gu, linux-spi, linux-amlogic, linux-arm-kernel
  Cc: LKML, Dongliang Mu, Jerome Brunet, Johan Hovold, Kevin Hilman,
	Mark Brown, Martin Blumenstingl, Neil Armstrong

> Just code review, I have fixed a similar one before.

Can such information mean also that any source code search approaches
would be involved here?
https://en.wikipedia.org/wiki/Code_review

Regards,
Markus


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

* Re: spi: meson-spicc: Fix double-put in remove path
  2026-03-23 18:44     ` Markus Elfring
@ 2026-03-23 18:47       ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-03-23 18:47 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Felix Gu, linux-spi, linux-amlogic, linux-arm-kernel, LKML,
	Dongliang Mu, Jerome Brunet, Johan Hovold, Kevin Hilman,
	Martin Blumenstingl, Neil Armstrong

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

On Mon, Mar 23, 2026 at 07:44:21PM +0100, Markus Elfring wrote:
> > Just code review, I have fixed a similar one before.
> 
> Can such information mean also that any source code search approaches
> would be involved here?
> https://en.wikipedia.org/wiki/Code_review

Feel free to ignore Markus, he has a long history of sending
unhelpful review comments and continues to ignore repeated requests
to stop.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2026-03-24  0:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-22 13:29 [PATCH] spi: meson-spicc: Fix double-put in remove path Felix Gu
2026-03-22 15:40 ` Markus Elfring
2026-03-23 10:55 ` Johan Hovold
2026-03-23 11:33   ` Felix Gu
2026-03-23 18:44     ` Markus Elfring
2026-03-23 18:47       ` Mark Brown
2026-03-23 18:32 ` [PATCH] " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox