fix memory leak in fixed btusb_close
authorOliver Neukum <oliver@neukum.org>
Fri, 13 Nov 2009 13:26:23 +0000 (14:26 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 14 Nov 2009 20:57:08 +0000 (12:57 -0800)
If the waker is killed before it can replay outstanding URBs, these URBs
won't be freed or will be replayed at the next open.  This patch closes
the window by explicitely discarding outstanding URBs.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/bluetooth/btusb.c

index 2fb38027f3bb8773da3d380c8322cbb947c2ea57..44bc8bbabf5474948d59eb8ce15cff6bef11b819 100644 (file)
@@ -600,11 +600,13 @@ static int btusb_close(struct hci_dev *hdev)
        btusb_stop_traffic(data);
        err = usb_autopm_get_interface(data->intf);
        if (err < 0)
-               return 0;
+               goto failed;
 
        data->intf->needs_remote_wakeup = 0;
        usb_autopm_put_interface(data->intf);
 
+failed:
+       usb_scuttle_anchored_urbs(&data->deferred);
        return 0;
 }