This is a note to let you know that I've just added the patch titled wilc1000: Fix memleak in wilc_bus_probe to the 5.8-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: wilc1000-fix-memleak-in-wilc_bus_probe.patch and it can be found in the queue-5.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit f1a05d4af892cf04a823203b6b9ec1b6738a21b3 Author: Dinghao Liu <dinghao.liu@xxxxxxxxxx> Date: Thu Aug 20 13:52:56 2020 +0800 wilc1000: Fix memleak in wilc_bus_probe [ Upstream commit 9a19a939abfa7d949f584a7ad872e683473fdc14 ] When devm_clk_get() returns -EPROBE_DEFER, spi_priv should be freed just like when wilc_cfg80211_init() fails. Fixes: 854d66df74aed ("staging: wilc1000: look for rtc_clk clock in spi mode") Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx> Acked-by: Ajay Singh <ajay.kathat@xxxxxxxxxxxxx> Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/20200820055256.24333-1-dinghao.liu@xxxxxxxxxx Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/staging/wilc1000/spi.c b/drivers/staging/wilc1000/spi.c index 3f19e3f38a397..a18dac0aa6b67 100644 --- a/drivers/staging/wilc1000/spi.c +++ b/drivers/staging/wilc1000/spi.c @@ -112,9 +112,10 @@ static int wilc_bus_probe(struct spi_device *spi) wilc->dev_irq_num = spi->irq; wilc->rtc_clk = devm_clk_get(&spi->dev, "rtc_clk"); - if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) + if (PTR_ERR_OR_ZERO(wilc->rtc_clk) == -EPROBE_DEFER) { + kfree(spi_priv); return -EPROBE_DEFER; - else if (!IS_ERR(wilc->rtc_clk)) + } else if (!IS_ERR(wilc->rtc_clk)) clk_prepare_enable(wilc->rtc_clk); return 0;