1. 28 9月, 2020 1 次提交
  2. 27 8月, 2020 1 次提交
  3. 05 6月, 2020 1 次提交
  4. 27 5月, 2020 1 次提交
    • G
      cfg80211: Replace zero-length array with flexible-array · 396fba0a
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      sizeof(flexible-array-member) triggers a warning because flexible array
      members have incomplete type[1]. There are some instances of code in
      which the sizeof operator is being incorrectly/erroneously applied to
      zero-length arrays and the result is zero. Such instances may be hiding
      some bugs. So, this work (flexible-array member conversions) will also
      help to get completely rid of those sorts of issues.
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/r/20200507183909.GA12993@embeddedorSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      396fba0a
  5. 24 4月, 2020 2 次提交
  6. 07 2月, 2020 1 次提交
  7. 11 9月, 2019 1 次提交
  8. 29 7月, 2019 1 次提交
    • S
      cfg80211: fix duplicated scan entries after channel switch · 0afd425b
      Sergey Matyukevich 提交于
      When associated BSS completes channel switch procedure, its channel
      record needs to be updated. The existing mac80211 solution was
      extended to cfg80211 in commit 5dc8cdce ("mac80211/cfg80211:
      update bss channel on channel switch").
      
      However that solution still appears to be incomplete as it may lead
      to duplicated scan entries for associated BSS after channel switch.
      The root cause of the problem is as follows. Each BSS entry is
      included into the following data structures:
      - bss list rdev->bss_list
      - bss search tree rdev->bss_tree
      Updating BSS channel record without rebuilding bss_tree may break
      tree search since cmp_bss considers all of the following: channel,
      bssid, ssid. When BSS channel is updated, but its location in bss_tree
      is not updated, then subsequent search operations may fail to locate
      this BSS since they will be traversing bss_tree in wrong direction.
      As a result, for scan performed after associated BSS channel switch,
      cfg80211_bss_update may add the second entry for the same BSS to both
      bss_list and bss_tree, rather then update the existing one.
      
      To summarize, if BSS channel needs to be updated, then bss_tree should
      be rebuilt in order to put updated BSS entry into a proper location.
      
      This commit suggests the following straightforward solution:
      - if new entry has been already created for BSS after channel switch,
        then use its IEs to update known BSS entry and then remove new
        entry completely
      - use rb_erase/rb_insert_bss reinstall updated BSS in bss_tree
      - for nontransmit BSS entry, the whole transmit BSS hierarchy
        is updated
      Signed-off-by: NSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
      Link: https://lore.kernel.org/r/20190726163922.27509-3-sergey.matyukevich.os@quantenna.comSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      0afd425b
  9. 28 5月, 2019 1 次提交
    • C
      cfg80211: Handle bss expiry during connection · a3ce17d1
      Chaitanya Tata 提交于
      If the BSS is expired during connection, the connect result will
      trigger a kernel warning. Ideally cfg80211 should hold the BSS
      before the connection is attempted, but as the BSSID is not known
      in case of auth/assoc MLME offload (connect op) it doesn't.
      
      For those drivers without the connect op cfg80211 holds down the
      reference so it wil not be removed from list.
      
      Fix this by removing the warning and silently adding the BSS back to
      the bss list which is return by the driver (with proper BSSID set) or
      in case the BSS is already added use that.
      
      The requirements for drivers are documented in the API's.
      Signed-off-by: NChaitanya Tata <chaitanya.tata@bluwireless.co.uk>
      [formatting fixes, keep old timestamp]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      a3ce17d1
  10. 08 2月, 2019 3 次提交
  11. 01 2月, 2019 1 次提交
    • J
      cfg80211: call disconnect_wk when AP stops · e005bd7d
      Johannes Berg 提交于
      Since we now prevent regulatory restore during STA disconnect
      if concurrent AP interfaces are active, we need to reschedule
      this check when the AP state changes. This fixes never doing
      a restore when an AP is the last interface to stop. Or to put
      it another way: we need to re-check after anything we check
      here changes.
      
      Cc: stable@vger.kernel.org
      Fixes: 113f3aaa ("cfg80211: Prevent regulatory restore during STA disconnect in concurrent interfaces")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e005bd7d
  12. 09 11月, 2018 1 次提交
    • J
      cfg80211: add peer measurement with FTM initiator API · 9bb7e0f2
      Johannes Berg 提交于
      Add a new "peer measurement" API, that can be used to measure
      certain things related to a peer. Right now, only implement
      FTM (flight time measurement) over it, but the idea is that
      it'll be extensible to also support measuring the necessary
      things to calculate e.g. angle-of-arrival for WiGig.
      
      The API is structured to have a generic list of peers and
      channels to measure with/on, and then for each of those a
      set of measurements (again, only FTM right now) to perform.
      
      Results are sent to the requesting socket, including a final
      complete message.
      
      Closing the controlling netlink socket will abort a running
      measurement.
      
      v3:
       - add a bit to report "final" for partial results
       - remove list keeping etc. and just unicast out the results
         to the requester (big code reduction ...)
       - also send complete message unicast, and as a result
         remove the multicast group
       - separate out struct cfg80211_pmsr_ftm_request_peer
         from struct cfg80211_pmsr_request_peer
       - document timeout == 0 if no timeout
       - disallow setting timeout nl80211 attribute to 0,
         must not include attribute for no timeout
       - make MAC address randomization optional
       - change num bursts exponent default to 0 (1 burst, rather
         rather than the old default of 15==don't care)
      
      v4:
       - clarify NL80211_ATTR_TIMEOUT documentation
      
      v5:
       - remove unnecessary nl80211 multicast/family changes
       - remove partial results bit/flag, final is sufficient
       - add max_bursts_exponent, max_ftms_per_burst to capability
       - rename "frames per burst" -> "FTMs per burst"
      
      v6:
       - rename cfg80211_pmsr_free_wdev() to cfg80211_pmsr_wdev_down()
         and call it in leave, so the device can't go down with any
         pending measurements
      
      v7:
       - wording fixes (Lior)
       - fix ftm.max_bursts_exponent to allow having the limit of 0 (Lior)
      
      v8:
       - copyright statements
       - minor coding style fixes
       - fix error path leak
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9bb7e0f2
  13. 02 10月, 2018 2 次提交
  14. 29 6月, 2018 1 次提交
    • A
      cfg80211: track time using boottime · fe0984d3
      Arnd Bergmann 提交于
      The cfg80211 layer uses get_seconds() to read the current time
      in its supend handling. This function is deprecated because of the 32-bit
      time_t overflow, and it can cause unexpected behavior when the time
      changes due to settimeofday() calls or leap second updates.
      
      In many cases, we want to use monotonic time instead, however cfg80211
      explicitly tracks the time spent in suspend, so this changes the
      driver over to use ktime_get_boottime_seconds(), which is slightly
      slower, but not used in a fastpath here.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      fe0984d3
  15. 29 3月, 2018 2 次提交
  16. 15 1月, 2018 1 次提交
    • J
      mac80211_hwsim: validate number of different channels · 51a1aaa6
      Johannes Berg 提交于
      When creating a new radio on the fly, hwsim allows this
      to be done with an arbitrary number of channels, but
      cfg80211 only supports a limited number of simultaneous
      channels, leading to a warning.
      
      Fix this by validating the number - this requires moving
      the define for the maximum out to a visible header file.
      
      Reported-by: syzbot+8dd9051ff19940290931@syzkaller.appspotmail.com
      Fixes: b59ec8dd ("mac80211_hwsim: fix number of channels in interface combinations")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      51a1aaa6
  17. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  18. 02 10月, 2017 1 次提交
    • A
      cfg80211/nl80211: add a port authorized event · 503c1fb9
      Avraham Stern 提交于
      Add an event that indicates that a connection is authorized
      (i.e. the 4 way handshake was performed by the driver). This event
      should be sent by the driver after sending a connect/roamed event.
      
      This is useful for networks that require 802.1X authentication.
      In cases that the driver supports 4 way handshake offload, but the
      802.1X authentication is managed by user space, the driver needs to
      inform user space right after the 802.11 association was completed
      so user space can initialize its 802.1X state machine etc.
      However, it is also possible that the AP will choose to skip the
      802.1X authentication (e.g. when PMKSA caching is used) and proceed
      with the 4 way handshake immediately. In this case the driver needs
      to inform user space that 802.1X authentication is no longer required
      (e.g. to prevent user space from disconnecting since it did not get
      any EAPOLs from the AP).
      
      This is also useful for roaming, in which case it is possible that
      the driver used the Fast Transition protocol so 802.1X is not
      required.
      
      Since there will now be a dedicated notification indicating that the
      connection is authorized, the authorized flag can be removed from the
      roamed event. Drivers can send the new port authorized event right
      after sending the roamed event to indicate the new AP is already
      authorized. This therefore reserves the old PORT_AUTHORIZED attribute.
      Signed-off-by: NAvraham Stern <avraham.stern@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      503c1fb9
  19. 28 4月, 2017 2 次提交
  20. 27 4月, 2017 2 次提交
  21. 13 4月, 2017 1 次提交
  22. 31 3月, 2017 1 次提交
  23. 06 3月, 2017 3 次提交
    • V
      cfg80211: Share Channel DFS state across wiphys of same DFS domain · 89766727
      Vasanthakumar Thiagarajan 提交于
      Sharing DFS channel state across multiple wiphys (radios) could
      be useful with multiple radios on the system. When one radio
      completes CAC and markes the channel available another radio
      can use this information and start beaconing without really doing
      CAC.
      
      Whenever there is a state change in dfs channel associated to
      a particular wiphy the the same state change is propagated to
      other wiphys having the same DFS reg domain configuration.
      Also when a new wiphy is created the dfs channel state of
      other existing wiphys of same DFS domain is copied.
      Signed-off-by: NVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      89766727
    • V
      cfg80211: Make pre-CAC results valid only for ETSI domain · b35a51c7
      Vasanthakumar Thiagarajan 提交于
      DFS requirement for ETSI domain (section 4.7.1.4 in
      ETSI EN 301 893 V1.8.1) is the only one which explicitly
      states that once DFS channel is marked as available afer
      the CAC, this channel will remain in available state even
      moving to a different operating channel. But the same is
      not explicitly stated in FCC DFS requirement. Also, Pre-CAC
      requriements are not explicitly mentioned in FCC requirement.
      Current implementation in keeping DFS channel in available
      state is same as described in ETSI domain.
      
      For non-ETSI DFS domain, this patch gives a grace period of 2 seconds
      since the completion of successful CAC before moving the channel's
      DFS state to 'usable' from 'available' state. The same grace period
      is checked against the channel's dfs_state_entered timestamp while
      deciding if a DFS channel is available for operation. There is a new
      radar event, NL80211_RADAR_PRE_CAC_EXPIRED, reported when DFS channel
      is moved from available to usable state after the grace period. Also
      make sure the DFS channel state is reset to usable once the beaconing
      operation on that channel is brought down (like stop_ap, leave_ibss
      and leave_mesh) in non-ETSI domain.
      Signed-off-by: NVasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      b35a51c7
    • A
      cfg80211: Accept multiple RSSI thresholds for CQM · 4a4b8169
      Andrew Zaborowski 提交于
      Change the SET CQM command's RSSI threshold attribute to accept any
      number of thresholds as a sorted array.  The API should be backwards
      compatible so that if one s32 threshold value is passed, the old
      mechanism is enabled.  The netlink event generated is the same in both
      cases.
      
      cfg80211 handles an arbitrary number of RSSI thresholds but drivers have
      to provide a method (set_cqm_rssi_range_config) that configures a range
      set by a high and a low value.  Drivers have to call back when the RSSI
      goes out of that range and there's no additional event for each time the
      range is reconfigured as there was with the current one-threshold API.
      
      This method doesn't have a hysteresis parameter because there's no
      benefit to the cfg80211 code from having the hysteresis be handled by
      hardware/driver in terms of the number of wakeups.  At the same time
      it would likely be less consistent between drivers if offloaded or
      done in the drivers.
      Signed-off-by: NAndrew Zaborowski <andrew.zaborowski@intel.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      4a4b8169
  24. 13 1月, 2017 1 次提交
  25. 09 1月, 2017 1 次提交
  26. 06 1月, 2017 1 次提交
  27. 09 12月, 2016 1 次提交
    • J
      cfg80211/mac80211: fix BSS leaks when abandoning assoc attempts · e6f462df
      Johannes Berg 提交于
      When mac80211 abandons an association attempt, it may free
      all the data structures, but inform cfg80211 and userspace
      about it only by sending the deauth frame it received, in
      which case cfg80211 has no link to the BSS struct that was
      used and will not cfg80211_unhold_bss() it.
      
      Fix this by providing a way to inform cfg80211 of this with
      the BSS entry passed, so that it can clean up properly, and
      use this ability in the appropriate places in mac80211.
      
      This isn't ideal: some code is more or less duplicated and
      tracing is missing. However, it's a fairly small change and
      it's thus easier to backport - cleanups can come later.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e6f462df
  28. 18 11月, 2016 1 次提交
    • J
      cfg80211: limit scan results cache size · 9853a55e
      Johannes Berg 提交于
      It's possible to make scanning consume almost arbitrary amounts
      of memory, e.g. by sending beacon frames with random BSSIDs at
      high rates while somebody is scanning.
      
      Limit the number of BSS table entries we're willing to cache to
      1000, limiting maximum memory usage to maybe 4-5MB, but lower
      in practice - that would be the case for having both full-sized
      beacon and probe response frames for each entry; this seems not
      possible in practice, so a limit of 1000 entries will likely be
      closer to 0.5 MB.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9853a55e
  29. 27 10月, 2016 1 次提交
    • J
      cfg80211: Rename SAE_DATA to more generic AUTH_DATA · 11b6b5a4
      Jouni Malinen 提交于
      This adds defines and nl80211 extensions to allow FILS Authentication to
      be implemented similarly to SAE. FILS does not need the special rules
      for the Authentication transaction number and Status code fields, but it
      does need to add non-IE fields. The previously used
      NL80211_ATTR_SAE_DATA can be reused for this to avoid having to
      duplicate that implementation. Rename that attribute to more generic
      NL80211_ATTR_AUTH_DATA (with backwards compatibility define for
      NL80211_SAE_DATA).
      
      Also document the special rules related to the Authentication
      transaction number and Status code fiels.
      Signed-off-by: NJouni Malinen <jouni@qca.qualcomm.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      11b6b5a4
  30. 13 10月, 2016 1 次提交
    • P
      cfg80211: support virtual interfaces with different beacon intervals · 0c317a02
      Purushottam Kushwaha 提交于
      This commit provides a mechanism for the host drivers to advertise the
      support for different beacon intervals among the respective interface
      combinations in a group, through NL80211_IFACE_COMB_BI_MIN_GCD (u32).
      
      This value will be compared against GCD of all beaconing interfaces of
      matching combinations.
      
      If the driver doesn't advertise this value, the old behaviour where
      all beacon intervals must be identical is retained.
      
      If it is specified, then any beacon interval for an interface in the
      interface combination as well as the GCD of all active beacon intervals
      in the combination must be greater or equal to this value.
      Signed-off-by: NPurushottam Kushwaha <pkushwah@qti.qualcomm.com>
      [change commit message, some variable names, small other things]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      0c317a02
  31. 30 9月, 2016 1 次提交