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>
This commit is contained in:
Oliver Neukum 2012-04-27 14:36:37 +02:00 committed by Greg Kroah-Hartman
parent 24a85bae5d
commit 2f338c8a19
1 changed files with 2 additions and 0 deletions

View File

@ -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;