spi: meson-spicc: Fix double-put in remove path
Subsystems (2)
PATCH 1/1 spi: meson-spicc: Fix double-put in remove path
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.
--- drivers/spi/spi-meson-spicc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spi-meson-spicc.c +0 -2
@@ -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,
Signature · 1 line
Felix Gu <[email protected]>
Quoted 3 lines
meson_spicc_probe()registers the controller withdevm_spi_register_controller(), so teardown already drops the controller reference via devm cleanup.
Were any source code analysis tools involved here?
Quoted 2 lines
Calling
spi_controller_put()again inmeson_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
Quoted 6 lines · Felix Gu
meson_spicc_probe()registers the controller withdevm_spi_register_controller(), so teardown already drops the controller reference via devm cleanup.Calling
spi_controller_put()again inmeson_spicc_remove()causes a double-put.
Indeed it does:
Quoted 1 line
Fixes 8311ee2164c5 ("spi: meson-spicc: fix memory leak in meson_spicc_remove")
While only root can trigger this it should probably still go stable:
Quoted 1 line
Signed-off-by Felix Gu <[email protected]>
How did you find this one? Are you using some kind of static analysis tool or LLM?
Johan
Quoted 8 lines
Indeed it does:
Reviewed-by Johan Hovold <[email protected]>Quoted 1 line
Fixes 8311ee2164c5 ("spi: meson-spicc: fix memory leak in meson_spicc_remove")While only root can trigger this it should probably still go stable:
Quoted 8 lines
Quoted 1 line
Signed-off-by Felix Gu <[email protected]>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
Quoted 1 line
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
Mark Brown
maintainerQuoted 5 lines · Markus Elfring
Quoted 1 line
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.
Mark Brown
maintainerQuoted 1 line · Felix Gu
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