]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ath10k: fix possible memory leak in ath10k_bmi_lz_data_large()
authorWei Yongjun <weiyongjun1@huawei.com>
Mon, 27 Apr 2020 10:43:48 +0000 (10:43 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:32:37 +0000 (09:32 +0200)
[ Upstream commit 2326aa011967f0afbcba7fe1a005d01f8b12900b ]

'cmd' is malloced in ath10k_bmi_lz_data_large() and should be freed
before leaving from the error handling cases, otherwise it will cause
memory leak.

Fixes: d58f466a5dee ("ath10k: add large size for BMI download data for SDIO")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200427104348.13570-1-weiyongjun1@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath10k/bmi.c

index ea908107581da83843c7263e48de1ac101c704b8..5b6db6e66f65df59957b4247897cdc6bcc170766 100644 (file)
@@ -380,6 +380,7 @@ static int ath10k_bmi_lz_data_large(struct ath10k *ar, const void *buffer, u32 l
                                                  NULL, NULL);
                if (ret) {
                        ath10k_warn(ar, "unable to write to the device\n");
+                       kfree(cmd);
                        return ret;
                }