Commit 7569109b authored by Oliver Neukum's avatar Oliver Neukum Committed by Ben Hutchings

USB: cdc-wdm: fix memory leak

commit 2f338c8a 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: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 811c72ba
...@@ -590,6 +590,8 @@ static int wdm_release(struct inode *inode, struct file *file) ...@@ -590,6 +590,8 @@ static int wdm_release(struct inode *inode, struct file *file)
kill_urbs(desc); kill_urbs(desc);
if (!test_bit(WDM_DISCONNECTING, &desc->flags)) if (!test_bit(WDM_DISCONNECTING, &desc->flags))
desc->intf->needs_remote_wakeup = 0; desc->intf->needs_remote_wakeup = 0;
else
cleanup(desc);
} }
mutex_unlock(&wdm_mutex); mutex_unlock(&wdm_mutex);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment