Skip to content

Commit

Permalink
USB: cdc-wdm: fix memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Apr 30, 2012
1 parent 24a85ba commit 2f338c8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2f338c8

Please sign in to comment.