diff options
author | Oliver Neukum <oliver@neukum.org> | 2012-04-27 14:36:37 +0200 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2012-05-31 00:43:32 +0100 |
commit | 7569109b102712a5b04d5be7820d54f8dad93b90 (patch) | |
tree | 1ed185b6edc28728f60fc2fb28ee60c1c967d8b0 | |
parent | 811c72ba0a81cbbca676656341413dbbde20b438 (diff) |
USB: cdc-wdm: fix memory leak
commit 2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4 upstream.
cleanup() is not called if the last close() comes after
disconnect(). That leads to a memory leak. Rectified
by checking for an earlier disconnect() in release()
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index ac9099af7cd7..cfe5be43d568 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -590,6 +590,8 @@ static int wdm_release(struct inode *inode, struct file *file) kill_urbs(desc); if (!test_bit(WDM_DISCONNECTING, &desc->flags)) desc->intf->needs_remote_wakeup = 0; + else + cleanup(desc); } mutex_unlock(&wdm_mutex); return 0; |