diff mbox series

[for-5.10] spi: npcm-fiu: Don't leak SPI master in probe error path

Message ID a420c23a363a3bc9aa684c6e790c32a8af106d17.1605512876.git.lukas@wunner.de (mailing list archive)
State Accepted
Commit 04a9cd51d3f3308a98cbc6adc07acb12fbade011
Headers show
Series [for-5.10] spi: npcm-fiu: Don't leak SPI master in probe error path | expand

Commit Message

Lukas Wunner Nov. 16, 2020, 8:23 a.m. UTC
If the calls to of_match_device(), of_alias_get_id(),
devm_ioremap_resource(), devm_regmap_init_mmio() or devm_clk_get()
fail on probe of the NPCM FIU SPI driver, the spi_controller struct is
erroneously not freed.

Fix by switching over to the new devm_spi_alloc_master() helper.

Fixes: ace55c411b11 ("spi: npcm-fiu: add NPCM FIU controller driver")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: <stable@vger.kernel.org> # v5.4+: 5e844cc37a5c: spi: Introduce device-managed SPI controller allocation
Cc: <stable@vger.kernel.org> # v5.4+
Cc: Tomer Maimon <tmaimon77@gmail.com>
---
 drivers/spi/spi-npcm-fiu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Nov. 17, 2020, 10:38 p.m. UTC | #1
On Mon, 16 Nov 2020 09:23:10 +0100, Lukas Wunner wrote:
> If the calls to of_match_device(), of_alias_get_id(),
> devm_ioremap_resource(), devm_regmap_init_mmio() or devm_clk_get()
> fail on probe of the NPCM FIU SPI driver, the spi_controller struct is
> erroneously not freed.
> 
> Fix by switching over to the new devm_spi_alloc_master() helper.

Applied to

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

Thanks!

[1/1] spi: npcm-fiu: Don't leak SPI master in probe error path
      commit: 04a9cd51d3f3308a98cbc6adc07acb12fbade011

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
Mark Brown Dec. 1, 2020, 1:57 p.m. UTC | #2
On Mon, 16 Nov 2020 09:23:10 +0100, Lukas Wunner wrote:
> If the calls to of_match_device(), of_alias_get_id(),
> devm_ioremap_resource(), devm_regmap_init_mmio() or devm_clk_get()
> fail on probe of the NPCM FIU SPI driver, the spi_controller struct is
> erroneously not freed.
> 
> Fix by switching over to the new devm_spi_alloc_master() helper.

Applied to

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

Thanks!

[1/1] spi: npcm-fiu: Don't leak SPI master in probe error path
      (no commit info)

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
Lukas Wunner Dec. 1, 2020, 2:30 p.m. UTC | #3
On Tue, Dec 01, 2020 at 01:57:56PM +0000, Mark Brown wrote:
> On Mon, 16 Nov 2020 09:23:10 +0100, Lukas Wunner wrote:
> > If the calls to of_match_device(), of_alias_get_id(),
> > devm_ioremap_resource(), devm_regmap_init_mmio() or devm_clk_get()
> > fail on probe of the NPCM FIU SPI driver, the spi_controller struct is
> > erroneously not freed.
> > 
> > Fix by switching over to the new devm_spi_alloc_master() helper.
> 
> Applied to
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
> 
> Thanks!
> 
> [1/1] spi: npcm-fiu: Don't leak SPI master in probe error path
>       (no commit info)

This patch is already in Linus' tree.
(You applied it to spi.git on Nov 17.)

Thanks,

Lukas
Mark Brown Dec. 1, 2020, 5:17 p.m. UTC | #4
On Tue, Dec 01, 2020 at 03:30:27PM +0100, Lukas Wunner wrote:
> On Tue, Dec 01, 2020 at 01:57:56PM +0000, Mark Brown wrote:

> > [1/1] spi: npcm-fiu: Don't leak SPI master in probe error path
> >       (no commit info)

> This patch is already in Linus' tree.
> (You applied it to spi.git on Nov 17.)

Yes, b4 had a bug which caused it to generate notification e-mails
for things it didn't find in git (as you can see from the "no commit
info" bit).  BTW it would be really helpful if you could resend this
stuff in some more normal fashion (either independently or as a numbered
thread), it's really breaking my workflow.
Lukas Wunner Dec. 1, 2020, 5:49 p.m. UTC | #5
On Tue, Dec 01, 2020 at 05:17:26PM +0000, Mark Brown wrote:
> BTW it would be really helpful if you could resend this
> stuff in some more normal fashion (either independently or as a numbered
> thread), it's really breaking my workflow.

Will do, sorry for the inconvenience.

I think I'll base the resent patches on for-5.11, Linus would probably
not be happy to receive such a large quantity of commits this late in the
cycle.  (Shout if you disagree.)

Thanks,

Lukas
Mark Brown Dec. 2, 2020, 3:17 p.m. UTC | #6
On Tue, Dec 01, 2020 at 06:49:08PM +0100, Lukas Wunner wrote:

> I think I'll base the resent patches on for-5.11, Linus would probably
> not be happy to receive such a large quantity of commits this late in the
> cycle.  (Shout if you disagree.)

That's probably sensible yes.
diff mbox series

Patch

diff --git a/drivers/spi/spi-npcm-fiu.c b/drivers/spi/spi-npcm-fiu.c
index 341f7cffeaac..1cb9329de945 100644
--- a/drivers/spi/spi-npcm-fiu.c
+++ b/drivers/spi/spi-npcm-fiu.c
@@ -679,7 +679,7 @@  static int npcm_fiu_probe(struct platform_device *pdev)
 	struct resource *res;
 	int id;
 
-	ctrl = spi_alloc_master(dev, sizeof(*fiu));
+	ctrl = devm_spi_alloc_master(dev, sizeof(*fiu));
 	if (!ctrl)
 		return -ENOMEM;