Skip to contentSkip to conversation

mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

PATCH In review Navid Emamdoost 4 participants 4 messages Oct 4, 2019 – Oct 9, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

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")
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +4 -1
index eff06d59e9df..096334e941a1 100644
@@ -687,8 +687,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);
 
Signature · 1 line
2.17.1
#3 lore raw
In reply to Navid Emamdoost
Quoted 7 lines · Navid Emamdoost

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")

Patch applied to wireless-drivers-next.git, thanks.

d10dcb615c8e mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

Signature · 3 lines
https://patchwork.kernel.org/patch/11175265/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches