diff mbox series

mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf

Message ID 20191004200853.23353-1-navid.emamdoost@gmail.com (mailing list archive)
State Accepted
Commit db8fd2cde93227e566a412cf53173ffa227998bc
Delegated to: Kalle Valo
Headers show
Series mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf | expand

Commit Message

Navid Emamdoost Oct. 4, 2019, 8:08 p.m. UTC
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 <navid.emamdoost@gmail.com>
---
 drivers/net/wireless/marvell/mwifiex/pcie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ganapathi Bhat Oct. 5, 2019, 1:51 a.m. UTC | #1
Hi Navid,

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

Thanks for the change;

Acked-by: Ganapathi Bhat <gbhat@marvell.com>

Regards,
Ganapathi
Markus Elfring Oct. 5, 2019, 4:48 p.m. UTC | #2
> 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.

Please improve this change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=4ea655343ce4180fe9b2c7ec8cb8ef9884a47901#n151

Regards,
Markus
Kalle Valo Oct. 9, 2019, 8:25 a.m. UTC | #3
Navid Emamdoost <navid.emamdoost@gmail.com> wrote:

> 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 <navid.emamdoost@gmail.com>
> Acked-by: Ganapathi Bhat <gbhat@marvell.com>

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

db8fd2cde932 mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
diff mbox series

Patch

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;