Skip to contentSkip to conversation

fix memory leak in fixed btusb_close

PATCH In review Oliver Neukum 2 participants 2 messages Nov 13, 2009 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix memory leak in fixed btusb_close

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.

Linus,

this fixes a memory leak in your fix of btusb.

Regards
Oliver

--

commit 8a3e793888c75bc7a49ff8b0be7ec6bd5438d985

Author: Oliver Neukum <[email protected]>
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

drivers/bluetooth/btusb.c +3 -1
index 2fb3802..44bc8bb 100644
@@ -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;
 }
 
maintainer Acked-by on v1 1/1
#1 lore raw

Hi Linus,

Quoted 17 lines

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.

Linus,

this fixes a memory leak in your fix of btusb.

Regards
Oliver

--

commit 8a3e793888c75bc7a49ff8b0be7ec6bd5438d985

Quoted 8 lines
Author: Oliver Neukum <[email protected]>
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

In case you wanna take it this late. Otherwise let me know and I queue it up for the next merge window.

Regards

Marcel