Skip to contentSkip to conversation

mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf

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_alloc_cmdrsp_buf

In mwifiex_pcie_alloc_cmdrsp_buf, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release is added.

Fixes fc3314609047 ("mwifiex: use pci_alloc/free_consistent APIs for PCIe")
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/pcie.c +3 -1
index eff06d59e9df..1578eaa071bd 100644
@@ -1029,8 +1029,10 @@ static int mwifiex_pcie_alloc_cmdrsp_buf(struct mwifiex_adapter *adapter)
 	}
 	skb_put(skb, MWIFIEX_UPLD_SIZE);
 	if (mwifiex_map_pci_memory(adapter, skb, MWIFIEX_UPLD_SIZE,
-				   PCI_DMA_FROMDEVICE))
+				   PCI_DMA_FROMDEVICE)) {
+		kfree_skb(skb);
 		return -1;
+	}
 
 	card->cmdrsp_buf = skb;
 
Signature · 1 line
2.17.1
#3 lore raw
In reply to Navid Emamdoost
Quoted 6 lines · Navid Emamdoost

In mwifiex_pcie_alloc_cmdrsp_buf, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release is added.

Fixes fc3314609047 ("mwifiex: use pci_alloc/free_consistent APIs for PCIe")

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

db8fd2cde932 mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf

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

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