From: Oliver Neukum Date: Fri, 27 Apr 2012 12:36:37 +0000 (+0200) Subject: USB: cdc-wdm: fix memory leak X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=2f338c8a1904e2e7aa5a8bd12fb0cf2422d17da4;p=openwrt%2Fstaging%2Fblogic.git 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 Cc: stable Signed-off-by: Greg Kroah-Hartman --- 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;