]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.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)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 06:00:53 +0000 (01:00 -0500)
BugLink: https://bugs.launchpad.net/bugs/1862227
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>
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/wireless/marvell/mwifiex/pcie.c

index 89969a38ad66af28cea865ca690a7e3314cbe467..8c1c4168c2ca1c2af09e404ea971821b12ea7755 100644 (file)
@@ -1046,8 +1046,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;