* fix memory leak in fixed btusb_close
@ 2009-11-12 15:52 Oliver Neukum
2009-11-12 22:13 ` Rafael J. Wysocki
2009-11-13 3:08 ` Marcel Holtmann
0 siblings, 2 replies; 5+ messages in thread
From: Oliver Neukum @ 2009-11-12 15:52 UTC (permalink / raw)
To: Rafael J. Wysocki, Marcel Holtmann, linux-bluetooth
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>
Rafael, could you test this just to make sure? I don't want to screw
up the same driver twice.
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] 5+ messages in thread* Re: fix memory leak in fixed btusb_close
2009-11-12 15:52 fix memory leak in fixed btusb_close Oliver Neukum
@ 2009-11-12 22:13 ` Rafael J. Wysocki
2009-11-13 3:08 ` Marcel Holtmann
1 sibling, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2009-11-12 22:13 UTC (permalink / raw)
To: Oliver Neukum; +Cc: Marcel Holtmann, linux-bluetooth
On Thursday 12 November 2009, Oliver Neukum wrote:
> 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>
>
> Rafael, could you test this just to make sure? I don't want to screw
> up the same driver twice.
It doesn't appear to kill the box right away and I have no traces of failure
in the logs after several consecutive suspend-resume cycles.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fix memory leak in fixed btusb_close
2009-11-12 15:52 fix memory leak in fixed btusb_close Oliver Neukum
2009-11-12 22:13 ` Rafael J. Wysocki
@ 2009-11-13 3:08 ` Marcel Holtmann
2009-11-13 9:53 ` Oliver Neukum
1 sibling, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2009-11-13 3:08 UTC (permalink / raw)
To: Oliver Neukum; +Cc: Rafael J. Wysocki, linux-bluetooth
Hi Oliver,
> 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>
> Rafael, could you test this just to make sure? I don't want to screw
> up the same driver twice.
Feel free to send this directly to Linus for inclusion.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fix memory leak in fixed btusb_close
2009-11-13 3:08 ` Marcel Holtmann
@ 2009-11-13 9:53 ` Oliver Neukum
2009-11-13 11:14 ` Marcel Holtmann
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2009-11-13 9:53 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: Rafael J. Wysocki, linux-bluetooth
Am Freitag, 13. November 2009 04:08:20 schrieb Marcel Holtmann:
> Hi Oliver,
>
> > 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>
>
> > Rafael, could you test this just to make sure? I don't want to screw
> > up the same driver twice.
>
> Feel free to send this directly to Linus for inclusion.
This late in the RCs?
Regards
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fix memory leak in fixed btusb_close
2009-11-13 9:53 ` Oliver Neukum
@ 2009-11-13 11:14 ` Marcel Holtmann
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2009-11-13 11:14 UTC (permalink / raw)
To: Oliver Neukum; +Cc: Rafael J. Wysocki, linux-bluetooth
Hi Oliver,
> > > 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>
> >
> > > Rafael, could you test this just to make sure? I don't want to screw
> > > up the same driver twice.
> >
> > Feel free to send this directly to Linus for inclusion.
>
> This late in the RCs?
he can decide not to take it if chooses, but from my point of view it
worth fixing.
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-13 11:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 15:52 fix memory leak in fixed btusb_close Oliver Neukum
2009-11-12 22:13 ` Rafael J. Wysocki
2009-11-13 3:08 ` Marcel Holtmann
2009-11-13 9:53 ` Oliver Neukum
2009-11-13 11:14 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox