• Ian Campbell's avatar
    [PATCH] Avoid deadlock in smc91x driver · d20a8fb5
    Ian Campbell authored
    This patch avoids a deadlock on rtnl_sem in smc_close() when bringing down
    an smc91x interface.  The semaphore is already held by devinet_ioctl() and
    the pending work queue contains linkwatch_event() (scheduled by
    netif_carrier_off()) which also wants rtnl_sem hence it is unsafe to call
    flush_scheduled_work().
    
    The solution is to track whether we have any pending work of our own and
    wait for that instead of flushing the entire queue.
    
    I also fixed a typo 'ence' -> 'Hence' and renamed smc_detect_phy to
    smc_phy_detect in order to follow the same pattern as the other smc_phy_*
    functions.
    Signed-off-by: default avatarIan Campbell <icampbell@arcom.com>
    Signed-off-by: default avatarNicolas Pitre <nico@cam.org>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    d20a8fb5
smc91x.c 56.4 KB