This is a note to let you know that I've just added the patch titled spi: npcm-fiu: Don't leak SPI master in probe error path to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: spi-npcm-fiu-don-t-leak-spi-master-in-probe-error-path.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 04a9cd51d3f3308a98cbc6adc07acb12fbade011 Mon Sep 17 00:00:00 2001 From: Lukas Wunner <lukas@xxxxxxxxx> Date: Mon, 16 Nov 2020 09:23:10 +0100 Subject: spi: npcm-fiu: Don't leak SPI master in probe error path From: Lukas Wunner <lukas@xxxxxxxxx> commit 04a9cd51d3f3308a98cbc6adc07acb12fbade011 upstream. 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@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> # v5.4+: 5e844cc37a5c: spi: Introduce device-managed SPI controller allocation Cc: <stable@xxxxxxxxxxxxxxx> # v5.4+ Cc: Tomer Maimon <tmaimon77@xxxxxxxxx> Link: https://lore.kernel.org/r/a420c23a363a3bc9aa684c6e790c32a8af106d17.1605512876.git.lukas@xxxxxxxxx Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/spi/spi-npcm-fiu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -680,7 +680,7 @@ static int npcm_fiu_probe(struct platfor int ret; int id; - ctrl = spi_alloc_master(dev, sizeof(*fiu)); + ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); if (!ctrl) return -ENOMEM; Patches currently in stable-queue which might be from lukas@xxxxxxxxx are queue-5.4/spi-bcm2835aux-fix-use-after-free-on-unbind.patch queue-5.4/spi-lpspi-fix-use-after-free-on-unbind.patch queue-5.4/spi-npcm-fiu-don-t-leak-spi-master-in-probe-error-path.patch queue-5.4/spi-introduce-device-managed-spi-controller-allocation.patch