wifi: plfxlc: fix potential memory leak in __lf_x_usb_enable_rx()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Sat, 19 Nov 2022 05:19:00 +0000 (13:19 +0800)
committerKalle Valo <kvalo@kernel.org>
Mon, 28 Nov 2022 13:56:17 +0000 (15:56 +0200)
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20221119051900.1192401-1-william.xuanziyang@huawei.com
drivers/net/wireless/purelifi/plfxlc/usb.c

index 39e54b3..76d0a77 100644 (file)
@@ -247,6 +247,7 @@ error:
                for (i = 0; i < RX_URBS_COUNT; i++)
                        free_rx_urb(urbs[i]);
        }
+       kfree(urbs);
        return r;
 }