• Johannes Berg's avatar
    iwlwifi: mvm: defer setting IWL_MVM_STATUS_IN_HW_RESTART · bf8b286f
    Johannes Berg authored
    A hardware/firmware error may happen at any point in time. In
    particular, it might happen while mac80211 is in the middle of
    a flow. We observed the following situation:
     * mac80211 is in authentication flow, in ieee80211_prep_connection()
     * iwlwifi firmware crashes, but no error can be reported at this
       precise point (mostly because the driver method is void, but even
       if it wasn't we'd just shift to a race condition)
     * mac80211 continues the flow, trying to add the AP station
     * iwlwifi has already set its internal restart flag, and so thinks
       that adding the station is part of the restart and already set up,
       so it uses the information that's supposed to already be in the
       struct
    
    This can happen with any flow in mac80211 and with any information
    we try to preserve across hardware restarts.
    
    To fix this, only set a new HW_RESTART_REQUESTED flag and translate
    that to IN_HW_RESTART once mac80211 actually starts the restart by
    calling our start() method. As a consequence, any mac80211 flow in
    progress at the time of the restart will properly finish (certainly
    with errors), before the restart is attempted.
    
    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=195299.
    Reported-by: default avatardjagoo <dev@djagoo.io>
    Reported-by: default avatarŁukasz Siudut <lsiudut@gmail.com>
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
    bf8b286f
mac80211.c 121 KB