diff options
author | Oliver Neukum <oliver@neukum.org> | 2012-04-27 14:36:37 +0200 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2012-06-04 21:58:12 +0200 |
commit | 0be7fa4bbc63ddea52976fcef09b8a3e196ca462 (patch) | |
tree | 7a0f0e459b1c11df79ae39bfb33039273da6fbfb | |
parent | 6c4d667e1e6cf3d7a87ddf7082f6d8e2670facd1 (diff) |
USB: cdc-wdm: fix memory leak
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>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4)
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-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 fba4e8ac1ef..6ec73d8cc22 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -625,6 +625,8 @@ static int wdm_release(struct inode *inode, struct file *file) kill_urbs(desc); if (!test_bit(WDM_DISCONNECTING, &desc->flags)) desc->manage_power(desc->intf, 0); + else + cleanup(desc); } mutex_unlock(&wdm_mutex); return 0; |