]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mwifiex: pcie: Fix memory leak in mwifiex_pcie_alloc_cmdrsp_buf
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Fri, 4 Oct 2019 20:08:52 +0000 (15:08 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 10 Dec 2019 18:01:31 +0000 (18:01 +0000)
commit db8fd2cde93227e566a412cf53173ffa227998bc upstream.

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>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
[bwh: Backported to 3.16: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/wireless/mwifiex/pcie.c

index c4e1dc70cea5d412434f28818f1c58852d47257b..f7f1568c4ac817604549c6200bca58dcb80dae93 100644 (file)
@@ -876,8 +876,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;