Commit 10c588de authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

brcmfmac: fix leak of mypkt on error return path

[ Upstream commit a927e8d8 ]

Currently if the call to brcmf_sdiod_set_backplane_window fails 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.  Also remove redundant check on err before calling
brcmf_sdiod_skbuff_write.

Addresses-Coverity: ("Resource Leak")
Fixes: a7c3aa15 ("brcmfmac: Remove brcmf_sdiod_addrprep()")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 047b402d
...@@ -617,15 +617,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes) ...@@ -617,15 +617,13 @@ int brcmf_sdiod_send_buf(struct brcmf_sdio_dev *sdiodev, u8 *buf, uint nbytes)
err = brcmf_sdiod_set_backplane_window(sdiodev, addr); err = brcmf_sdiod_set_backplane_window(sdiodev, addr);
if (err) if (err)
return err; goto out;
addr &= SBSDIO_SB_OFT_ADDR_MASK; addr &= SBSDIO_SB_OFT_ADDR_MASK;
addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; addr |= SBSDIO_SB_ACCESS_2_4B_FLAG;
if (!err) err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, mypkt);
err = brcmf_sdiod_skbuff_write(sdiodev, sdiodev->func2, addr, out:
mypkt);
brcmu_pkt_buf_free_skb(mypkt); brcmu_pkt_buf_free_skb(mypkt);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment