* [patch]fix memory leak in fixed btusb_close
@ 2009-11-13 13:26 Oliver Neukum
2009-11-13 14:17 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2009-11-13 13:26 UTC (permalink / raw)
To: Rafael J. Wysocki, Marcel Holtmann, linux-bluetooth,
Linus Torvalds
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>
Linus,
this fixes a memory leak in your fix of btusb.
Regards
Oliver
--
commit 8a3e793888c75bc7a49ff8b0be7ec6bd5438d985
Author: Oliver Neukum <oliver@neukum.org>
Date: Thu Nov 12 16:41:46 2009 +0100
btusb: close race in disconnect leading to a memory leak
if the waker work is cancelled any deferred IO must be discarded
in close to free the memory and make sure the data isn't replayed
later
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 2fb3802..44bc8bb 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [patch]fix memory leak in fixed btusb_close
2009-11-13 13:26 [patch]fix memory leak in fixed btusb_close Oliver Neukum
@ 2009-11-13 14:17 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2009-11-13 14:17 UTC (permalink / raw)
To: Oliver Neukum; +Cc: Rafael J. Wysocki, linux-bluetooth, Linus Torvalds
Hi Linus,
> 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>
>
> Linus,
>
> this fixes a memory leak in your fix of btusb.
>
> Regards
> Oliver
>
> --
>
> commit 8a3e793888c75bc7a49ff8b0be7ec6bd5438d985
> Author: Oliver Neukum <oliver@neukum.org>
> Date: Thu Nov 12 16:41:46 2009 +0100
>
> btusb: close race in disconnect leading to a memory leak
>
> if the waker work is cancelled any deferred IO must be discarded
> in close to free the memory and make sure the data isn't replayed
> later
Acked-by: Marcel Holtmann <marcel@holtmann.org>
In case you wanna take it this late. Otherwise let me know and I queue
it up for the next merge window.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-13 14:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13 13:26 [patch]fix memory leak in fixed btusb_close Oliver Neukum
2009-11-13 14:17 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox