diff mbox series

mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

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

Commit Message

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

Comments

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

> Fixes: 0732484b47b5 ("mwifiex: separate ring initialization and ring creation
> routines")

Thanks for the this change as well;

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

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

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

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

d10dcb615c8e mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
index eff06d59e9df..096334e941a1 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);