[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <165391051496.5601.1908067980296464087.kvalo@kernel.org>
Date: Mon, 30 May 2022 11:35:17 +0000 (UTC)
From: Kalle Valo <kvalo@...nel.org>
To: Jianglei Nie <niejianglei2021@....com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, ath11k@...ts.infradead.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jianglei Nie <niejianglei2021@....com>
Subject: Re: [PATCH v2] ath11k: mhi: fix potential memory leak in
ath11k_mhi_register()
Jianglei Nie <niejianglei2021@....com> wrote:
> 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 because ab_pci->mhi_ctrl has a dangling pointer
> to the freed memory. But when ath11k_mhi_read_addr_from_dt() fails, the
> function returns without calling mhi_free_controller(), which will lead
> to a memory leak.
>
> We can fix it by calling mhi_free_controller() when
> ath11k_mhi_read_addr_from_dt() fails and set ab_pci->mhi_ctrl = NULL in
> all of the places where we call mhi_free_controller().
>
> Signed-off-by: Jianglei Nie <niejianglei2021@....com>
Fails to apply, please rebase on top of ath.git master branch:
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/
error: patch failed: drivers/net/wireless/ath/ath11k/mhi.c:367
error: drivers/net/wireless/ath/ath11k/mhi.c: patch does not apply
stg import: Diff does not apply cleanly
Patch set to Changes Requested.
--
https://patchwork.kernel.org/project/linux-wireless/patch/20220530080610.143925-1-niejianglei2021@163.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Powered by blists - more mailing lists