netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
@ 2022-11-19  5:19 Ziyang Xuan
  2022-11-19  6:42 ` Kalle Valo
  2022-11-28 13:56 ` Kalle Valo
  0 siblings, 2 replies; 4+ messages in thread
From: Ziyang Xuan @ 2022-11-19  5:19 UTC (permalink / raw)
  To: srini.raju, kvalo, davem, edumazet, kuba, pabeni, linux-wireless,
	netdev
  Cc: linux-kernel

urbs does not be freed in exception paths in __lf_x_usb_enable_rx().
That will trigger memory leak. To fix it, add kfree() for urbs within
"error" label. Compile tested only.

Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
---
 drivers/net/wireless/purelifi/plfxlc/usb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c
index 39e54b3787d6..76d0a778636a 100644
--- a/drivers/net/wireless/purelifi/plfxlc/usb.c
+++ b/drivers/net/wireless/purelifi/plfxlc/usb.c
@@ -247,6 +247,7 @@ static int __lf_x_usb_enable_rx(struct plfxlc_usb *usb)
 		for (i = 0; i < RX_URBS_COUNT; i++)
 			free_rx_urb(urbs[i]);
 	}
+	kfree(urbs);
 	return r;
 }
 
-- 
2.25.1


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

end of thread, other threads:[~2022-11-28 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-19  5:19 [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx() Ziyang Xuan
2022-11-19  6:42 ` Kalle Valo
2022-11-19  9:20   ` Ziyang Xuan (William)
2022-11-28 13:56 ` 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).