Skip to content
  • Johannes Berg's avatar
    mac80211: insert stations before adding to driver · 5108ca82
    Johannes Berg authored
    
    
    There's a race condition in mac80211 because we add stations
    to the internal lists after adding them to the driver, which
    means that (for example) the following can happen:
     1. a station connects and is added
     2. first, it is added to the driver
     3. then, it is added to the mac80211 lists
    
    If the station goes to sleep between steps 2 and 3, and the
    firmware/hardware records it as being asleep, mac80211 will
    never instruct the driver to wake it up again as it never
    realized it went to sleep since the RX path discarded the
    frame as a "spurious class 3 frame", no station entry was
    present yet.
    
    Fix this by adding the station in software first, and only
    then adding it to the driver. That way, any state that the
    driver changes will be reflected properly in mac80211's
    station state. The problematic part is the roll-back if the
    driver fails to add the station, in that case a bit more is
    needed. To not make that overly complex prevent starting BA
    sessions in the meantime.
    
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    5108ca82