Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

carl9170: fix leaks at failure path in carl9170_usb_probe()

carl9170_usb_probe() does not handle request_firmware_nowait() failure
that leads to several leaks in this case.
The patch adds all required deallocations.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Alexey Khoroshilov and committed by
John W. Linville
5c2b6078 b88bb291

+7 -1
+7 -1
drivers/net/wireless/ath/carl9170/usb.c
··· 1076 1076 1077 1077 carl9170_set_state(ar, CARL9170_STOPPED); 1078 1078 1079 - return request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, 1079 + err = request_firmware_nowait(THIS_MODULE, 1, CARL9170FW_NAME, 1080 1080 &ar->udev->dev, GFP_KERNEL, ar, carl9170_usb_firmware_step2); 1081 + if (err) { 1082 + usb_put_dev(udev); 1083 + usb_put_dev(udev); 1084 + carl9170_free(ar); 1085 + } 1086 + return err; 1081 1087 } 1082 1088 1083 1089 static void carl9170_usb_disconnect(struct usb_interface *intf)