[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0d4531b-bece-e9f3-9347-e0325225b712@canonical.com>
Date: Tue, 9 Apr 2019 12:35:30 +0100
From: Colin Ian King <colin.king@...onical.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Arend van Spriel <arend.vanspriel@...adcom.com>,
Franky Lin <franky.lin@...adcom.com>,
Hante Meuleman <hante.meuleman@...adcom.com>,
Chi-Hsien Lin <chi-hsien.lin@...ress.com>,
Wright Feng <wright.feng@...ress.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S . Miller" <davem@...emloft.net>,
linux-wireless@...r.kernel.org,
brcm80211-dev-list.pdl@...adcom.com,
brcm80211-dev-list@...ress.com, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] brcmfmac: fix leak of mypkt on error return path
On 09/04/2019 12:32, Dan Carpenter wrote:
> On Tue, Apr 09, 2019 at 12:20:11PM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@...onical.com>
>>
>> Currently if the call to brcmf_sdiod_set_backplane_window fails then
>> then error return path leaks mypkt. Fix this by returning by a new
>> error path labelled 'out' that calls brcmu_pkt_buf_free_skb to free
>> mypkt.
>>
>> Addresses-Coverity: ("Resource Leak")
>> Fixes: a7c3aa1509e2 ("brcmfmac: Remove brcmf_sdiod_addrprep()")
>> Signed-off-by: Colin Ian King <colin.king@...onical.com>
>> ---
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
>> index ec129864cc9c..f3d11e024e71 100644
>> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
>> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c
>> @@ -628,7 +628,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
>>
>> err = brcmf_sdiod_set_backplane_window(sdiodev, addr);
>> if (err)
>> - return err;
>> + goto out;
>>
>> addr &= SBSDIO_SB_OFT_ADDR_MASK;
>> addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
>> @@ -636,7 +636,7 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
>> if (!err)
> ^^^^
> This is not required, btw.
Good point.
>
>> err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr,
>> mypkt);
>> -
>> +out:
>> brcmu_pkt_buf_free_skb(mypkt);
>
> regards,
> dan carpenter
>
Powered by blists - more mailing lists