From: Navid Emamdoost Date: Fri, 4 Oct 2019 20:16:48 +0000 (-0500) Subject: mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring X-Git-Tag: Ubuntu-4.15.0-87.87~327 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ab051590e1a65c5422bb651d949bf6f849b13a8e;p=mirror_ubuntu-bionic-kernel.git mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring BugLink: https://bugs.launchpad.net/bugs/1859712 [ Upstream commit d10dcb615c8e29d403a24d35f8310a7a53e3050c ] In mwifiex_pcie_init_evt_ring, a new skb is allocated which should be released if mwifiex_map_pci_memory() fails. The release for skb and card->evtbd_ring_vbase is added. Fixes: 0732484b47b5 ("mwifiex: separate ring initialization and ring creation routines") Signed-off-by: Navid Emamdoost Acked-by: Ganapathi Bhat Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c index 9fff7774ff96..df2a725099ab 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -687,8 +687,11 @@ static int mwifiex_pcie_init_evt_ring(struct mwifiex_adapter *adapter) skb_put(skb, MAX_EVENT_SIZE); if (mwifiex_map_pci_memory(adapter, skb, MAX_EVENT_SIZE, - PCI_DMA_FROMDEVICE)) + PCI_DMA_FROMDEVICE)) { + kfree_skb(skb); + kfree(card->evtbd_ring_vbase); return -1; + } buf_pa = MWIFIEX_SKB_DMA_ADDR(skb);