1. 01 4月, 2015 1 次提交
    • J
      mac80211: fix RX A-MPDU session reorder timer deletion · 788211d8
      Johannes Berg 提交于
      There's an issue with the way the RX A-MPDU reorder timer is
      deleted that can cause a kernel crash like this:
      
       * tid_rx is removed - call_rcu(ieee80211_free_tid_rx)
       * station is destroyed
       * reorder timer fires before ieee80211_free_tid_rx() runs,
         accessing the station, thus potentially crashing due to
         the use-after-free
      
      The station deletion is protected by synchronize_net(), but
      that isn't enough -- ieee80211_free_tid_rx() need not have
      run when that returns (it deletes the timer.) We could use
      rcu_barrier() instead of synchronize_net(), but that's much
      more expensive.
      
      Instead, to fix this, add a field tracking that the session
      is being deleted. In this case, the only re-arming of the
      timer happens with the reorder spinlock held, so make that
      code not rearm it if the session is being deleted and also
      delete the timer after setting that field. This ensures the
      timer cannot fire after ___ieee80211_stop_rx_ba_session()
      returns, which fixes the problem.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      788211d8
  2. 16 3月, 2015 3 次提交
  3. 03 3月, 2015 2 次提交
  4. 27 2月, 2015 1 次提交
    • J
      mac80211: Send EAPOL frames at lowest rate · 9c1c98a3
      Jouni Malinen 提交于
      The current minstrel_ht rate control behavior is somewhat optimistic in
      trying to find optimum TX rate. While this is usually fine for normal
      Data frames, there are cases where a more conservative set of retry
      parameters would be beneficial to make the connection more robust.
      
      EAPOL frames are critical to the authentication and especially the
      EAPOL-Key message 4/4 (the last message in the 4-way handshake) is
      important to get through to the AP. If that message is lost, the only
      recovery mechanism in many cases is to reassociate with the AP and start
      from scratch. This can often be avoided by trying to send the frame with
      more conservative rate and/or with more link layer retries.
      
      In most cases, minstrel_ht is currently using the initial EAPOL-Key
      frames for probing higher rates and this results in only five link layer
      transmission attempts (one at high(ish) MCS and four at MCS0). While
      this works with most APs, it looks like there are some deployed APs that
      may have issues with the EAPOL frames using HT MCS immediately after
      association. Similarly, there may be issues in cases where the signal
      strength or radio environment is not good enough to be able to get
      frames through even at couple of MCS 0 tries.
      
      The best approach for this would likely to be to reduce the TX rate for
      the last rate (3rd rate parameter in the set) to a low basic rate (say,
      6 Mbps on 5 GHz and 2 or 5.5 Mbps on 2.4 GHz), but doing that cleanly
      requires some more effort. For now, we can start with a simple one-liner
      that forces the minimum rate to be used for EAPOL frames similarly how
      the TX rate is selected for the IEEE 802.11 Management frames. This does
      result in a small extra latency added to the cases where the AP would be
      able to receive the higher rate, but taken into account how small number
      of EAPOL frames are used, this is likely to be insignificant. A future
      optimization in the minstrel_ht design can also allow this patch to be
      reverted to get back to the more optimized initial TX rate.
      
      It should also be noted that many drivers that do not use minstrel as
      the rate control algorithm are already doing similar workarounds by
      forcing the lowest TX rate to be used for EAPOL frames.
      
      Cc: stable@vger.kernel.org
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Tested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJouni Malinen <jouni@qca.qualcomm.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9c1c98a3
  5. 25 2月, 2015 1 次提交
    • J
      mac80211/minstrel: fix !x!=0 confusion · 17dce158
      Jiri Slaby 提交于
      Commit 06d961a8 ("mac80211/minstrel: use the new rate control API")
      inverted the condition 'if (msr->sample_limit != 0)' to
      'if (!msr->sample_limit != 0)'. But it is confusing both to people and
      compilers (gcc5):
      net/mac80211/rc80211_minstrel.c: In function 'minstrel_get_rate':
      net/mac80211/rc80211_minstrel.c:376:26: warning: logical not is only applied to the left hand side of comparison
         if (!msr->sample_limit != 0)
                                ^
      
      Let there be only 'if (!msr->sample_limit)'.
      
      Fixes: 06d961a8 ("mac80211/minstrel: use the new rate control API")
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      17dce158
  6. 24 2月, 2015 1 次提交
  7. 27 1月, 2015 5 次提交
  8. 23 1月, 2015 12 次提交
    • J
      mac80211: support beacon statistics · 225b8189
      Johannes Berg 提交于
      For drivers without beacon filtering, support beacon statistics
      entirely, i.e. report the number of beacons and average signal.
      
      For drivers with beacon filtering, give them the number of beacons
      received by mac80211 -- in case the device reports only the number
      of filtered beacons then driver doesn't have to count all beacons
      again as mac80211 already does.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      225b8189
    • J
      mac80211: fix per-TID RX-MSDU counter · 3d6dc343
      Johannes Berg 提交于
      In the case of non-QoS association, the counter was actually
      wrong. The right index isn't security_idx but seqno_idx, as
      security_idx will be 0 for data frames, while 16 is needed.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      3d6dc343
    • J
      mac80211: tdls: disentangle HT supported conditions · c5309ba7
      Johannes Berg 提交于
      These conditions are rather difficult to follow, for example
      because "!sta" only exists to not crash in the case that we
      don't have a station pointer (WLAN_TDLS_SETUP_REQUEST) in
      which the additional condition (peer supports HT) doesn't
      actually matter anyway.
      
      Cleaning this up only duplicates two lines of code but makes
      the rest far easier to read, so do that.
      
      As a side effect, smatch stops complaining about the lack of
      a sta pointer test after the !sta (since the !sta goes away)
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c5309ba7
    • J
      mac80211: tdls: remove shadowing variable · d6f5cc09
      Johannes Berg 提交于
      There's no need to use another local 'sta' variable as the
      original (outer scope) one isn't needed any more and has
      become invalid anyway when exiting the RCU read section.
      
      Remove the inner scope one and along with it the useless NULL
      initialization.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      d6f5cc09
    • B
      Revert "mac80211: keep sending peer candidate events while in listen state" · 985e88b1
      Bob Copeland 提交于
      This reverts commit 2ae70efc.
      
      The new peer events that are generated by the change are causing problems
      with wpa_supplicant in userspace: wpa_s tries to restart SAE authentication
      with the peer when receiving the event, even though authentication may be in
      progress already, and it gets very confused.
      
      Revert back to the original operating mode, which is to only get events when
      there is no corresponding station entry.
      
      Cc: Nishikawa, Kenzoh <Kenzoh.Nishikawa@jp.sony.com>
      Cc: Masashi Honma <masashi.honma@gmail.com>
      Signed-off-by: NBob Copeland <me@bobcopeland.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      985e88b1
    • L
      mac80211: complete scan work immediately if quiesced or suspended · 332ff7fe
      Luciano Coelho 提交于
      It is possible that a deferred scan is queued after the queues are
      flushed in __ieee80211_suspend().  The deferred scan work may be
      scheduled by ROC or ieee80211_stop_poll().
      
      To make sure don't start a new scan while suspending, check whether
      we're quiescing or suspended and complete the scan immediately if
      that's the case.
      Signed-off-by: NLuciano Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      332ff7fe
    • E
      mac80211: avoid races related to suspend flow · 4afaff17
      Emmanuel Grumbach 提交于
      When we go to suspend, there is complex set of states that
      avoids races. The quiescing variable is set whlie
      __ieee80211_suspend is running. Then suspended is set.
      The code makes sure there is no window without any of these
      flags.
      
      The problem is that workers can still be enqueued while we
      are quiescing. This leads to situations where the driver is
      already suspending and other flows like disassociation are
      handled by a worker.
      
      To fix this, we need to check quiescing and suspended flags
      in the worker itself and not only before enqueueing it.
      I also add here extensive documentation to ease the
      understanding of these complex issues.
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      4afaff17
    • E
      mac80211: synchronize_net() before flushing the queues · 14f2ae83
      Emmanuel Grumbach 提交于
      When mac80211 disconnects, it drops all the packets on the
      queues. This happens after the net stack has been notified
      that we have no link anymore (netif_carrier_off).
      netif_carrier_off ensures that no new packets are sent to
      xmit() callback, but we might have older packets in the
      middle of the Tx path. These packets will land in the
      driver's queues after the latter have been flushed.
      Synchronize_net() between netif_carrier_off and drv_flush()
      will fix this.
      
      Note that we can't call synchronize_net inside
      ieee80211_flush_queues since there are flows that call
      ieee80211_flush_queues and don't need synchronize_net()
      which is an expensive operation.
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      [reword comment to be more accurate]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      14f2ae83
    • M
      mac80211: properly set CCK flag in radiotap · 3a5c5e81
      Mathy Vanhoef 提交于
      Fix a regression introduced by commit a5e70697 ("mac80211: add radiotap flag
      and handling for 5/10 MHz") where the IEEE80211_CHAN_CCK channel type flag was
      incorrectly replaced by the IEEE80211_CHAN_OFDM flag. This commit fixes that by
      using the CCK flag again.
      
      Cc: stable@vger.kernel.org
      Fixes: a5e70697 ("mac80211: add radiotap flag and handling for 5/10 MHz")
      Signed-off-by: NMathy Vanhoef <vanhoefm@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      3a5c5e81
    • L
      mac80211: only roll back station states for WDS when suspending · 2af81d67
      Luciano Coelho 提交于
      In normal cases (i.e. when we are fully associated), cfg80211 takes
      care of removing all the stations before calling suspend in mac80211.
      
      But in the corner case when we suspend during authentication or
      association, mac80211 needs to roll back the station states.  But we
      shouldn't roll back the station states in the suspend function,
      because this is taken care of in other parts of the code, except for
      WDS interfaces.  For AP types of interfaces, cfg80211 takes care of
      disconnecting all stations before calling the driver's suspend code.
      For station interfaces, this is done in the quiesce code.
      
      For WDS interfaces we still need to do it here, so move the code into
      a new switch case for WDS.
      
      Cc: stable@kernel.org [3.15+]
      Signed-off-by: NLuciano Coelho <luciano.coelho@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      2af81d67
    • L
      mac80211: enable TPC through mac80211 stack · db82d8a9
      Lorenzo Bianconi 提交于
      Control per packet Transmit Power Control (TPC) in lower drivers
      according to TX power settings configured by the user. In particular TPC is
      enabled if value passed in enum nl80211_tx_power_setting is
      NL80211_TX_POWER_LIMITED (allow using less than specified from userspace),
      whereas TPC is disabled if nl80211_tx_power_setting is set to
      NL80211_TX_POWER_FIXED (use value configured from userspace)
      Signed-off-by: NLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      db82d8a9
    • J
      mac80211: allow drivers to control software crypto · fa7e1fbc
      Johannes Berg 提交于
      Some drivers unfortunately cannot support software crypto, but
      mac80211 currently assumes that they do.
      
      This has the issue that if the hardware enabling fails for some
      reason, the software fallback is used, which won't work. This
      clearly isn't desirable, the error should be reported and the
      key setting refused.
      
      Support this in mac80211 by allowing drivers to set a new HW
      flag IEEE80211_HW_SW_CRYPTO_CONTROL, in which case mac80211 will
      only allow software fallback if the set_key() method returns 1.
      The driver will also need to advertise supported cipher suites
      so that mac80211 doesn't advertise any (future) software ciphers
      that the driver can't actually do.
      
      While at it, to make it easier to support this, refactor the
      ieee80211_init_cipher_suites() code.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      fa7e1fbc
  9. 22 1月, 2015 1 次提交
    • J
      mac80211: fix HW registration error paths · 54330bf6
      Johannes Berg 提交于
      Station info state is started in allocation, so should be
      destroyed on free (it's just a timer); rate control must
      be freed if anything afterwards fails to initialize.
      
      LED exit should be later, no need for locking there, but
      it needs to be done also when rate init failed.
      
      Also clean up the code by moving a label so the locking
      doesn't have to be done separately.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      54330bf6
  10. 20 1月, 2015 1 次提交
    • E
      mac80211: delete the assoc/auth timer upon suspend · c1e140bf
      Emmanuel Grumbach 提交于
      While suspending, we destroy the authentication /
      association that might be taking place. While doing so, we
      forgot to delete the timer which can be firing after
      local->suspended is already set, producing the warning below.
      
      Fix that by deleting the timer.
      
      [66722.825487] WARNING: CPU: 2 PID: 5612 at net/mac80211/util.c:755 ieee80211_can_queue_work.isra.18+0x32/0x40 [mac80211]()
      [66722.825487] queueing ieee80211 work while going to suspend
      [66722.825529] CPU: 2 PID: 5612 Comm: kworker/u16:69 Tainted: G        W  O  3.16.1+ #24
      [66722.825537] Workqueue: events_unbound async_run_entry_fn
      [66722.825545] Call Trace:
      [66722.825552]  <IRQ>  [<ffffffff817edbb2>] dump_stack+0x4d/0x66
      [66722.825556]  [<ffffffff81075cad>] warn_slowpath_common+0x7d/0xa0
      [66722.825572]  [<ffffffffa06b5b90>] ? ieee80211_sta_bcn_mon_timer+0x50/0x50 [mac80211]
      [66722.825573]  [<ffffffff81075d1c>] warn_slowpath_fmt+0x4c/0x50
      [66722.825586]  [<ffffffffa06977a2>] ieee80211_can_queue_work.isra.18+0x32/0x40 [mac80211]
      [66722.825598]  [<ffffffffa06977d5>] ieee80211_queue_work+0x25/0x50 [mac80211]
      [66722.825611]  [<ffffffffa06b5bac>] ieee80211_sta_timer+0x1c/0x20 [mac80211]
      [66722.825614]  [<ffffffff8108655a>] call_timer_fn+0x8a/0x300
      Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c1e140bf
  11. 16 1月, 2015 2 次提交
  12. 15 1月, 2015 1 次提交
  13. 14 1月, 2015 5 次提交
  14. 09 1月, 2015 1 次提交
    • J
      mac80211: fix handling TIM IE when stations disconnect · 9b7a86f3
      Johannes Berg 提交于
      When a station disconnects with frames still pending, we clear
      the TIM bit, but too late - it's only cleared when the station
      is already removed from the driver, and thus the driver can get
      confused (and hwsim will loudly complain.)
      
      Fix this by clearing the TIM bit earlier, when the station has
      been unlinked but not removed from the driver yet. To do this,
      refactor the TIM recalculation to in that case ignore traffic
      and simply assume no pending traffic - this is correct for the
      disconnected station even though the frames haven't been freed
      yet at that point.
      
      This patch isn't needed for current drivers though as they don't
      check the station argument to the set_tim() operation and thus
      don't really run into the possible confusion.
      Reported-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9b7a86f3
  15. 08 1月, 2015 3 次提交
    • J
      mac80211: provide per-TID RX/TX MSDU counters · 79c892b8
      Johannes Berg 提交于
      Implement the new counters cfg80211 can now advertise to userspace.
      The TX code is in the sequence number handler, which is a bit odd,
      but that place already knows the TID and frame type, so it was
      easiest and least impact there.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      79c892b8
    • J
      cfg80211: remove enum station_info_flags · 319090bf
      Johannes Berg 提交于
      This is really just duplicating the list of information that's
      already available in the nl80211 attribute, so remove the list.
      Two small changes are needed:
       * remove STATION_INFO_ASSOC_REQ_IES complete, but the length
         (assoc_req_ies_len) can be used instead
       * add NL80211_STA_INFO_RX_DROP_MISC which exists internally
         but not in nl80211 yet
      
      This gets rid of the duplicate maintenance of the two lists.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      319090bf
    • J
      mac80211: allow drivers to provide most station statistics · 2b9a7e1b
      Johannes Berg 提交于
      In many cases, drivers can filter things like beacons that will
      skew statistics reported by mac80211. To get correct statistics
      in these cases, call drivers to obtain statistics and let them
      override all values, filling values from mac80211 if the driver
      didn't provide them. Not all of them make sense for the driver
      to fill, so some are still always done by mac80211.
      
      Note that this doesn't currently allow a driver to say "I know
      this value is wrong, don't report it at all", or to sum it up
      with a mac80211 value (as could be useful for "dropped misc"),
      that can be added if it turns out to be needed.
      
      This also gets rid of the get_rssi() method as is can now be
      implemented using sta_statistics().
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      2b9a7e1b