]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
wifi: ath12k: mhi: fix potential memory leak in ath12k_mhi_register()
authorMa Ke <make_ruc2021@163.com>
Sat, 30 Sep 2023 04:54:47 +0000 (07:54 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:14:42 +0000 (17:14 +0000)
commitb2e99ba69ce6ac41867c1544cf94476f6c674d0f
treeafd2c1d4c8ce7a0ceed16e48feb6bbd6a6959e7e
parentfb3a71a8383f716c9b18a0ea420c7746deb3a5a4
wifi: ath12k: mhi: fix potential memory leak in ath12k_mhi_register()

[ Upstream commit 47c27aa7ded4b8ead19b3487cc42a6185b762903 ]

mhi_alloc_controller() allocates a memory space for mhi_ctrl. When some
errors occur, mhi_ctrl should be freed by mhi_free_controller() and set
ab_pci->mhi_ctrl = NULL.

We can fix it by calling mhi_free_controller() when the failure happens
and set ab_pci->mhi_ctrl = NULL in all of the places where we call
mhi_free_controller().

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230922021036.3604157-1-make_ruc2021@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/wireless/ath/ath12k/mhi.c