summaryrefslogtreecommitdiff
path: root/drivers/usb/class/cdc-wdm.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2012-04-27 16:36:37 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-30 05:53:41 +0400
commit2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4 (patch)
tree0d0e6ded4a8e9334187b84ccc311ccb250cc9f33 /drivers/usb/class/cdc-wdm.c
parent24a85bae5da2b43fed423859c09c5a81ab359473 (diff)
downloadlinux-2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4.tar.xz
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>
Diffstat (limited to 'drivers/usb/class/cdc-wdm.c')
-rw-r--r--drivers/usb/class/cdc-wdm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index b29a9815e4d2..650e1da4d2bf 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -622,6 +622,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;