Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Arend Van Spriel <arend.vanspriel@broadcom.com>
To: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Cc: takafumi@sslab.ics.keio.ac.jp,
Franky Lin <franky.lin@broadcom.com>,
Hante Meuleman <hante.meuleman@broadcom.com>,
Chi-Hsien Lin <chi-hsien.lin@cypress.com>,
Wright Feng <wright.feng@cypress.com>,
Kalle Valo <kvalo@codeaurora.org>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
<linux-wireless@vger.kernel.org>,
"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
<brcm80211-dev-list.pdl@broadcom.com>,
"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
<brcm80211-dev-list@cypress.com>,
"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] brcmsmac: fix potential memory leak in wlc_phy_attach_lcnphy
Date: Mon, 7 Sep 2020 22:46:52 +0200 [thread overview]
Message-ID: <bad4e33a-af2f-b44f-63e5-56386c312a91@broadcom.com> (raw)
In-Reply-To: <20200907162245.17997-1-keitasuzuki.park@sslab.ics.keio.ac.jp>
On 9/7/2020 6:22 PM, Keita Suzuki wrote:
> When wlc_phy_txpwr_srom_read_lcnphy fails in wlc_phy_attach_lcnphy,
> the allocated pi->u.pi_lcnphy is leaked, since struct brcms_phy will be
> freed in the caller function.
>
> Fix this by calling wlc_phy_detach_lcnphy in the error handler of
> wlc_phy_txpwr_srom_read_lcnphy before returning.
>
> Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
> ---
> .../net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> index 7ef36234a25d..6d70f51b2ddf 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_lcn.c
> @@ -5065,8 +5065,10 @@ bool wlc_phy_attach_lcnphy(struct brcms_phy *pi)
> pi->pi_fptr.radioloftget = wlc_lcnphy_get_radio_loft;
> pi->pi_fptr.detach = wlc_phy_detach_lcnphy;
>
> - if (!wlc_phy_txpwr_srom_read_lcnphy(pi))
> + if (!wlc_phy_txpwr_srom_read_lcnphy(pi)) {
> + wlc_phy_detach_lcnphy(pi);
Essentially the same but I prefer to simply do the kfree() call directly
here as we also allocate in this function.
Thanks,
Arend
next prev parent reply other threads:[~2020-09-07 20:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-07 16:22 Keita Suzuki
2020-09-07 20:46 ` Arend Van Spriel [this message]
2020-09-08 0:13 ` [PATCH] brcmsmac: fix " Keita Suzuki
2020-09-08 11:18 ` Arend Van Spriel
2020-09-08 12:02 ` Keita Suzuki
2020-09-08 12:12 ` Arend Van Spriel
2020-09-08 12:17 ` [PATCH v2] " Keita Suzuki
2020-09-09 7:32 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bad4e33a-af2f-b44f-63e5-56386c312a91@broadcom.com \
--to=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211-dev-list@cypress.com \
--cc=chi-hsien.lin@cypress.com \
--cc=davem@davemloft.net \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=keitasuzuki.park@sslab.ics.keio.ac.jp \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=takafumi@sslab.ics.keio.ac.jp \
--cc=wright.feng@cypress.com \
--subject='Re: [PATCH] brcmsmac: fix potential memory leak in wlc_phy_attach_lcnphy' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).