diff mbox series

[net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()

Message ID 20221119051900.1192401-1-william.xuanziyang@huawei.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net] wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 7 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ziyang Xuan (William) Nov. 19, 2022, 5:19 a.m. UTC
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(+)

Comments

Kalle Valo Nov. 19, 2022, 6:42 a.m. UTC | #1
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.
Ziyang Xuan (William) Nov. 19, 2022, 9:20 a.m. UTC | #2
> 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.

>
Kalle Valo Nov. 28, 2022, 1:56 p.m. UTC | #3
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()
diff mbox series

Patch

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