netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
@ 2019-10-04 20:16 Navid Emamdoost
  2019-10-05  1:51 ` [EXT] " Ganapathi Bhat
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-04 20:16 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Amitkumar Karwar,
	Nishant Sarmukadam, Ganapathi Bhat, Xinming Hu, Kalle Valo,
	David S. Miller, linux-wireless, netdev, linux-kernel

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

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [EXT] [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
  2019-10-04 20:16 [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Navid Emamdoost
@ 2019-10-05  1:51 ` Ganapathi Bhat
  2019-10-05 17:00 ` Markus Elfring
  2019-10-09  8:25 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Ganapathi Bhat @ 2019-10-05  1:51 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, Amitkumar Karwar, Nishant Sarmukadam,
	Xinming Hu, Kalle Valo, David S. Miller, linux-wireless, netdev,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
  2019-10-04 20:16 [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Navid Emamdoost
  2019-10-05  1:51 ` [EXT] " Ganapathi Bhat
@ 2019-10-05 17:00 ` Markus Elfring
  2019-10-09  8:25 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-10-05 17:00 UTC (permalink / raw)
  To: Navid Emamdoost, linux-wireless, netdev
  Cc: Navid Emamdoost, Kangjie Lu, Stephen McCamant, Amitkumar Karwar,
	David S. Miller, Ganapathi Bhat, Kalle Valo, Nishant Sarmukadam,
	Xinming Hu, linux-kernel, kernel-janitors

> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring
  2019-10-04 20:16 [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Navid Emamdoost
  2019-10-05  1:51 ` [EXT] " Ganapathi Bhat
  2019-10-05 17:00 ` Markus Elfring
@ 2019-10-09  8:25 ` Kalle Valo
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-10-09  8:25 UTC (permalink / raw)
  To: Navid Emamdoost

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

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

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-09  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-04 20:16 [PATCH] mwifiex: pcie: Fix memory leak in mwifiex_pcie_init_evt_ring Navid Emamdoost
2019-10-05  1:51 ` [EXT] " Ganapathi Bhat
2019-10-05 17:00 ` Markus Elfring
2019-10-09  8:25 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).