From: Oliver Neukum Date: Fri, 27 Apr 2012 12:36:37 +0000 (+0200) Subject: USB: cdc-wdm: fix memory leak X-Git-Tag: v3.4.1~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fccfda602805358246118c8ed991a0cb32160d0f;p=platform%2Fkernel%2Flinux-stable.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 0209b46..6bf1a40 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;