Skip to content

Commit 2f338c8

Browse files
Oliver Neukumgregkh
authored andcommitted
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>
1 parent 24a85ba commit 2f338c8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/usb/class/cdc-wdm.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ static int wdm_release(struct inode *inode, struct file *file)
622622
kill_urbs(desc);
623623
if (!test_bit(WDM_DISCONNECTING, &desc->flags))
624624
desc->manage_power(desc->intf, 0);
625+
else
626+
cleanup(desc);
625627
}
626628
mutex_unlock(&wdm_mutex);
627629
return 0;

0 commit comments

Comments
 (0)