• Johannes Berg's avatar
    mac80211: shut down interfaces before destroying interface list · d8d9008c
    Johannes Berg authored
    If the hardware is unregistered while interfaces are up, mac80211 will
    unregister all interfaces, which in turns causes mac80211 to be called
    again to remove them all from the driver and eventually shut down the
    hardware.
    
    During this shutdown, however, it's currently already unsafe to iterate
    the list of interfaces atomically, as the list is manipulated in an
    unsafe manner. This puts an undue burden on the driver - it must stop
    all its activities before calling ieee80211_unregister_hw(), while in
    the normal stop path it can do all cleanup in the stop method. If, for
    example, it's using the iteration during RX for some reason, it would
    have to stop RX before unregistering to avoid crashes.
    
    Fix this problem by closing all interfaces before unregistering them.
    This will cause the driver stop to have completed before we manipulate
    the interface list, and after the driver is stopped *and* has called
    ieee80211_unregister_hw() it really musn't be iterating any more as
    the memory will be freed as well.
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    d8d9008c
iface.c 50.5 KB