linux-kernel.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

* Re: [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
  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
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2022-11-19  6:42 UTC (permalink / raw)
  To: Ziyang Xuan
  Cc: srini.raju, davem, edumazet, kuba, pabeni, linux-wireless,
	netdev, linux-kernel

Ziyang Xuan <william.xuanziyang@huawei.com> writes:

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

plfxlc patches go to wireless tree, not net. But I think I'll take this
to wireless-next actually.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

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

* Re: [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
  2022-11-19  6:42 ` Kalle Valo
@ 2022-11-19  9:20   ` Ziyang Xuan (William)
  0 siblings, 0 replies; 4+ messages in thread
From: Ziyang Xuan (William) @ 2022-11-19  9:20 UTC (permalink / raw)
  To: Kalle Valo
  Cc: srini.raju, davem, edumazet, kuba, pabeni, linux-wireless,
	netdev, linux-kernel

> Ziyang Xuan <william.xuanziyang@huawei.com> writes:
> 
>> 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(+)
> 
> plfxlc patches go to wireless tree, not net. But I think I'll take this
> to wireless-next actually.

OK, thanks.

> 

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

* Re: [PATCH net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
  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-28 13:56 ` Kalle Valo
  1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2022-11-28 13:56 UTC (permalink / raw)
  To: Ziyang Xuan
  Cc: srini.raju, davem, edumazet, kuba, pabeni, linux-wireless,
	netdev, linux-kernel

Ziyang Xuan <william.xuanziyang@huawei.com> wrote:

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

Patch applied to wireless-next.git, thanks.

895b3b06efc2 wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20221119051900.1192401-1-william.xuanziyang@huawei.com/

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


^ permalink raw reply	[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).