diff mbox series

libertas: Fix possible refcount leak in if_usb_probe()

Message ID 20220620092350.39960-1-hbh25y@gmail.com
State New
Headers show
Series libertas: Fix possible refcount leak in if_usb_probe() | expand

Commit Message

Hangyu Hua June 20, 2022, 9:23 a.m. UTC
usb_get_dev will be called before lbs_get_firmware_async which means that
usb_put_dev need to be called when lbs_get_firmware_async fails.

Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loading")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---
 drivers/net/wireless/marvell/libertas/if_usb.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Kalle Valo July 27, 2022, 12:48 p.m. UTC | #1
Hangyu Hua <hbh25y@gmail.com> wrote:

> usb_get_dev will be called before lbs_get_firmware_async which means that
> usb_put_dev need to be called when lbs_get_firmware_async fails.
> 
> Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loading")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>

Patch applied to wireless-next.git, thanks.

2cfb08d6c5c9 wifi: libertas: Fix possible refcount leak in if_usb_probe()
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c
index 5d6dc1dd050d..32fdc4150b60 100644
--- a/drivers/net/wireless/marvell/libertas/if_usb.c
+++ b/drivers/net/wireless/marvell/libertas/if_usb.c
@@ -287,6 +287,7 @@  static int if_usb_probe(struct usb_interface *intf,
 	return 0;
 
 err_get_fw:
+	usb_put_dev(udev);
 	lbs_remove_card(priv);
 err_add_card:
 	if_usb_reset_device(cardp);