• David Brownell's avatar
    [PATCH] USB: Fix machine lockup when unloading HC driver · da36985a
    David Brownell authored
    Alan Stern wrote:
    > I finally got tired of my computer locking up when I tried to rmmod the
    > low-level host controller driver.  It turns out the problem lies in the
    > root-hub status urb code in core/hcd.c -- primarily a result of
    > rh_report_status() not calling hcd_giveback_urb()...
    
    Or in short:  your patch removes some old logic for the "automagic
    interrupt transfer" special casing ... which recently started to
    break that rmmod path.
    
    With automagic, the only time an interrupt urb (like the root hub
    status urb) could legitimately be given back was for unlink.  But
    that unlink doesn't seem to be issued in the same way lately during
    the rmmod paths.  (If they're less bizarre lately, that's good!)
    
    
    > If this patch seems all right, will you please let Greg know it's okay to
    > apply it?
    
    I changed a couple minor things below ... basically (a) fixing the
    issue Duncan Sands pointed out (always call completions with irqs
    disabled, even if hub driver currently doesn't care), (b) better
    logic to avoid retriggering the timer during shutdown, (c) not
    doing del_timer_sync() while holding that lock, plus (d) a minor
    linewrap fix.
    da36985a
hcd.c 42.8 KB