diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2014-01-11 01:22:11 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-11 12:52:42 -0800 |
commit | b76ed59f75d646466eaf60cd73aa4d935ff7dbef (patch) | |
tree | 3567c9f5f676d084a634fd572283668e615a8218 | |
parent | 509e42e1d35350cc5c1bbf1800a0d743be16a63a (diff) | |
download | op-kernel-dev-b76ed59f75d646466eaf60cd73aa4d935ff7dbef.zip op-kernel-dev-b76ed59f75d646466eaf60cd73aa4d935ff7dbef.tar.gz |
staging: wlan-ng: fix leaks on failure paths in prism2sta_probe_usb()
There are leaks of resources allocated by wlan_setup() and usb_dev refcnt
on failure paths in prism2sta_probe_usb().
The patch adds appropriate deallocations and removes invalid code
from hfa384x_corereset() failure handling.
unregister_wlandev() is wrong because it is not registered yet.
hfa384x_destroy() is just noop in init state.
Found by Linux Driver Verification project (linuxtesting.org).
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/wlan-ng/prism2usb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index b401974..4739c14 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -140,11 +140,9 @@ static int prism2sta_probe_usb(struct usb_interface *interface, prism2_reset_holdtime, prism2_reset_settletime, 0); if (result != 0) { - unregister_wlandev(wlandev); - hfa384x_destroy(hw); result = -EIO; dev_err(&interface->dev, "hfa384x_corereset() failed.\n"); - goto failed; + goto failed_reset; } } @@ -159,11 +157,15 @@ static int prism2sta_probe_usb(struct usb_interface *interface, if (register_wlandev(wlandev) != 0) { dev_err(&interface->dev, "register_wlandev() failed.\n"); result = -EIO; - goto failed; + goto failed_register; } goto done; +failed_register: + usb_put_dev(dev); +failed_reset: + wlan_unsetup(wlandev); failed: kfree(wlandev); kfree(hw); |