2019-10-04 20:18:28

by Navid Emamdoost

[permalink] [raw]
Subject: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

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 <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/pcie.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

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);

--
2.17.1


2019-10-05 01:53:17

by Ganapathi Bhat

[permalink] [raw]
Subject: RE: [EXT] [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

Hi Navid,

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

Thanks for the this change as well;

Acked-by: Ganapathi Bhat <[email protected]>

Regards,
Ganapathi

2019-10-05 17:01:11

by Markus Elfring

[permalink] [raw]
Subject: Re: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

> 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

2019-10-09 08:28:43

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

Navid Emamdoost <[email protected]> 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 <[email protected]>
> Acked-by: Ganapathi Bhat <[email protected]>

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

d10dcb615c8e mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring

--
https://patchwork.kernel.org/patch/11175265/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches