aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNavid Emamdoost <[email protected]>2019-10-04 20:08:52 +0000
committerKalle Valo <[email protected]>2019-10-09 08:24:52 +0000
commitdb8fd2cde93227e566a412cf53173ffa227998bc (patch)
tree5ca5ecc7bfd2693bf9944992367c2358591e9c76
parentrsi: drop bogus device-id checks from probe (diff)
downloadkernel-db8fd2cde93227e566a412cf53173ffa227998bc.tar.gz
kernel-db8fd2cde93227e566a412cf53173ffa227998bc.zip
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") Signed-off-by: Navid Emamdoost <[email protected]> Acked-by: Ganapathi Bhat <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
-rw-r--r--drivers/net/wireless/marvell/mwifiex/pcie.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index eff06d59e9df..1578eaa071bd 100644
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
@@ -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;