WUSB: disconnect all devices when stopping a WUSB HCD
Make sure all WUSB devices are disconnected when stopping a WUSB HCD so that we don't leak the devices' wusb_dev structures. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f720af91ec
commit
8db324ec43
@@ -396,7 +396,8 @@ static void __wusbhc_dev_disconnect(struct wusbhc *wusbhc,
|
|||||||
|
|
||||||
/* After a device disconnects, change the GTK (see [WUSB]
|
/* After a device disconnects, change the GTK (see [WUSB]
|
||||||
* section 6.2.11.2). */
|
* section 6.2.11.2). */
|
||||||
wusbhc_gtk_rekey(wusbhc);
|
if (wusbhc->active)
|
||||||
|
wusbhc_gtk_rekey(wusbhc);
|
||||||
|
|
||||||
/* The Wireless USB part has forgotten about the device already; now
|
/* The Wireless USB part has forgotten about the device already; now
|
||||||
* khubd's timer will pick up the disconnection and remove the USB
|
* khubd's timer will pick up the disconnection and remove the USB
|
||||||
@@ -1084,15 +1085,21 @@ error_mmcie_set:
|
|||||||
* wusbhc_devconnect_stop - stop managing connected devices
|
* wusbhc_devconnect_stop - stop managing connected devices
|
||||||
* @wusbhc: the WUSB HC
|
* @wusbhc: the WUSB HC
|
||||||
*
|
*
|
||||||
* Removes the Host Info IE and stops the keep alives.
|
* Disconnects any devices still connected, stops the keep alives and
|
||||||
*
|
* removes the Host Info IE.
|
||||||
* FIXME: should this disconnect all devices?
|
|
||||||
*/
|
*/
|
||||||
void wusbhc_devconnect_stop(struct wusbhc *wusbhc)
|
void wusbhc_devconnect_stop(struct wusbhc *wusbhc)
|
||||||
{
|
{
|
||||||
cancel_delayed_work_sync(&wusbhc->keep_alive_timer);
|
int i;
|
||||||
WARN_ON(!list_empty(&wusbhc->cack_list));
|
|
||||||
|
|
||||||
|
mutex_lock(&wusbhc->mutex);
|
||||||
|
for (i = 0; i < wusbhc->ports_max; i++) {
|
||||||
|
if (wusbhc->port[i].wusb_dev)
|
||||||
|
__wusbhc_dev_disconnect(wusbhc, &wusbhc->port[i]);
|
||||||
|
}
|
||||||
|
mutex_unlock(&wusbhc->mutex);
|
||||||
|
|
||||||
|
cancel_delayed_work_sync(&wusbhc->keep_alive_timer);
|
||||||
wusbhc_mmcie_rm(wusbhc, &wusbhc->wuie_host_info->hdr);
|
wusbhc_mmcie_rm(wusbhc, &wusbhc->wuie_host_info->hdr);
|
||||||
kfree(wusbhc->wuie_host_info);
|
kfree(wusbhc->wuie_host_info);
|
||||||
wusbhc->wuie_host_info = NULL;
|
wusbhc->wuie_host_info = NULL;
|
||||||
|
Reference in New Issue
Block a user