• Alan Stern's avatar
    [PATCH] USB: Remove hub's children upon unbinding · 9b5310c6
    Alan Stern authored
    This patch fixes a logical hole in the hub driver.  It's possible for the
    driver to be unbound from a hub without physically unplugging the hub.
    For example, writing 0 into the bConfigurationValue attribute file will
    have this effect.  When this happens, we need to make sure that all the
    child devices of the hub are logically disconnected and their ports
    disabled.
    
    That's what this patch does.  It's a little bit tricky because we can't
    simply call usb_disconnect() from within the hub driver's disconnect()
    routine.  While that routine is running it holds the usb bus writelock,
    but usb_disconnect() would try to acquire it again.  Instead
    schedule_work() is used, so after a brief delay the children will be
    removed.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    9b5310c6
hub.c 56.3 KB