usbfs: fix race between open and unregister
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 24 Jun 2008 18:47:19 +0000 (14:47 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jul 2008 22:16:42 +0000 (15:16 -0700)
commitd64aac36394b3c26db53538bfedd8444a3a2206e
treeea532edd1cebaf62ba6f72b4c0f907fbf2b37cde
parent61ad04a89f0e3e6adaed0d9adfc0c9b431ccbb92
usbfs: fix race between open and unregister

This patch (as1106) fixes a race between opening and unregistering
device files in usbfs.  The current code drops its reference to the
device and then reacquires it, ignoring the possibility that the
device structure might have been removed in the meantime.  It also
doesn't check whether the device is already in the NOTATTACHED state
when the file is opened.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/devio.c