summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-10-04 15:16:48 -0500
committerBen Hutchings <ben@decadent.org.uk>2019-12-10 18:01:31 +0000
commit914927c7bac4ecd2351bdee0cd5b2b1c11150342 (patch)
tree40de3375604dab2712422919f7b0b5aca6b3fed6
parentf0eed3b1a34f1e7d8b2c06ad5ddf0ea60aea71ca (diff)
downloadlinux-914927c7bac4ecd2351bdee0cd5b2b1c11150342.tar.gz
linux-914927c7bac4ecd2351bdee0cd5b2b1c11150342.tar.bz2
linux-914927c7bac4ecd2351bdee0cd5b2b1c11150342.zip
mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
commit d10dcb615c8e29d403a24d35f8310a7a53e3050c upstream. In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release for skb and card->evtbd_ring_vbase is added. Fixes: 0732484b47b5 ("mwifiex: separate ring initialization and ring creation routines") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Acked-by: Ganapathi Bhat <gbhat@marvell.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> [bwh: Backported to 3.16: adjust filename] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/net/wireless/mwifiex/pcie.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
index f7f1568c4ac8..351dda2fa1ce 100644
--- a/drivers/net/wireless/mwifiex/pcie.c
+++ b/drivers/net/wireless/mwifiex/pcie.c
@@ -539,8 +539,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter)
skb_put(skb, MAX_EVENT_SIZE);
if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE,
- PCI_DMA_FROMDEVICE))
+ PCI_DMA_FROMDEVICE)) {
+ kfree_skb(skb);
+ kfree(card->evtbd_ring_vbase);
return -1;
+ }
buf_pa = MWIFIEX_SKB_DMA_ADDR(skb);