1. 29 1月, 2021 1 次提交
  2. 26 1月, 2021 1 次提交
    • J
      cfg80211: avoid holding the RTNL when calling the driver · a05829a7
      Johannes Berg 提交于
      Currently, _everything_ in cfg80211 holds the RTNL, and if you
      have a slow USB device (or a few) you can get some bad lock
      contention on that.
      
      Fix that by re-adding a mutex to each wiphy/rdev as we had at
      some point, so we have locking for the wireless_dev lists and
      all the other things in there, and also so that drivers still
      don't have to worry too much about it (they still won't get
      parallel calls for a single device).
      
      Then, we can restrict the RTNL to a few cases where we add or
      remove interfaces and really need the added protection. Some
      of the global list management still also uses the RTNL, since
      we need to have it anyway for netdev management, but we only
      hold the RTNL for very short periods of time here.
      
      Link: https://lore.kernel.org/r/20210122161942.81df9f5e047a.I4a8e1a60b18863ea8c5e6d3a0faeafb2d45b2f40@changeid
      Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> [marvell driver issues]
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      a05829a7
  3. 22 1月, 2021 1 次提交
    • J
      cfg80211: change netdev registration/unregistration semantics · 2fe8ef10
      Johannes Berg 提交于
      We used to not require anything in terms of registering netdevs
      with cfg80211, using a netdev notifier instead. However, in the
      next patch reducing RTNL locking, this causes big problems, and
      the simplest way is to just require drivers to do things better.
      
      Change the registration/unregistration semantics to require the
      drivers to call cfg80211_(un)register_netdevice() when this is
      happening due to a cfg80211 request, i.e. add_virtual_intf() or
      del_virtual_intf() (or if it somehow has to happen in any other
      cfg80211 callback).
      
      Otherwise, in other contexts, drivers may continue to use the
      normal netdev (un)registration functions as usual.
      
      Internally, we still use the netdev notifier and track (by the
      new wdev->registered bool) if the wdev had already been added
      to cfg80211 or not.
      
      Link: https://lore.kernel.org/r/20210122161942.cf2f4b65e4e9.Ida8234e50da13eb675b557bac52a713ad4eddf71@changeidSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      2fe8ef10
  4. 11 11月, 2020 1 次提交
  5. 30 10月, 2020 1 次提交
    • J
      cfg80211: initialize wdev data earlier · 9bdaf3b9
      Johannes Berg 提交于
      There's a race condition in the netdev registration in that
      NETDEV_REGISTER actually happens after the netdev is available,
      and so if we initialize things only there, we might get called
      with an uninitialized wdev through nl80211 - not using a wdev
      but using a netdev interface index.
      
      I found this while looking into a syzbot report, but it doesn't
      really seem to be related, and unfortunately there's no repro
      for it (yet). I can't (yet) explain how it managed to get into
      cfg80211_release_pmsr() from nl80211_netlink_notify() without
      the wdev having been initialized, as the latter only iterates
      the wdevs that are linked into the rdev, which even without the
      change here happened after init.
      
      However, looking at this, it seems fairly clear that the init
      needs to be done earlier, otherwise we might even re-init on a
      netns move, when data might still be pending.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      Link: https://lore.kernel.org/r/20201009135821.fdcbba3aad65.Ie9201d91dbcb7da32318812effdc1561aeaf4cdc@changeidSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      9bdaf3b9
  6. 28 9月, 2020 1 次提交
  7. 08 8月, 2020 1 次提交
    • W
      mm, treewide: rename kzfree() to kfree_sensitive() · 453431a5
      Waiman Long 提交于
      As said by Linus:
      
        A symmetric naming is only helpful if it implies symmetries in use.
        Otherwise it's actively misleading.
      
        In "kzalloc()", the z is meaningful and an important part of what the
        caller wants.
      
        In "kzfree()", the z is actively detrimental, because maybe in the
        future we really _might_ want to use that "memfill(0xdeadbeef)" or
        something. The "zero" part of the interface isn't even _relevant_.
      
      The main reason that kzfree() exists is to clear sensitive information
      that should not be leaked to other future users of the same memory
      objects.
      
      Rename kzfree() to kfree_sensitive() to follow the example of the recently
      added kvfree_sensitive() and make the intention of the API more explicit.
      In addition, memzero_explicit() is used to clear the memory to make sure
      that it won't get optimized away by the compiler.
      
      The renaming is done by using the command sequence:
      
        git grep -w --name-only kzfree |\
        xargs sed -i 's/kzfree/kfree_sensitive/'
      
      followed by some editing of the kfree_sensitive() kerneldoc and adding
      a kzfree backward compatibility macro in slab.h.
      
      [akpm@linux-foundation.org: fs/crypto/inline_crypt.c needs linux/slab.h]
      [akpm@linux-foundation.org: fix fs/crypto/inline_crypt.c some more]
      Suggested-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NWaiman Long <longman@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NMichal Hocko <mhocko@suse.com>
      Acked-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: "Serge E. Hallyn" <serge@hallyn.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
      Link: http://lkml.kernel.org/r/20200616154311.12314-3-longman@redhat.comSigned-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      453431a5
  8. 31 7月, 2020 1 次提交
  9. 05 6月, 2020 1 次提交
  10. 31 5月, 2020 2 次提交
  11. 25 5月, 2020 1 次提交
  12. 24 4月, 2020 2 次提交
  13. 20 3月, 2020 1 次提交
  14. 13 12月, 2019 1 次提交
  15. 11 9月, 2019 1 次提交
  16. 26 7月, 2019 2 次提交
  17. 14 6月, 2019 2 次提交
  18. 24 5月, 2019 1 次提交
    • M
      {nl,mac}80211: allow 4addr AP operation on crypto controlled devices · 33d915d9
      Manikanta Pubbisetty 提交于
      As per the current design, in the case of sw crypto controlled devices,
      it is the device which advertises the support for AP/VLAN iftype based
      on it's ability to tranmsit packets encrypted in software
      (In VLAN functionality, group traffic generated for a specific
      VLAN group is always encrypted in software). Commit db3bdcb9
      ("mac80211: allow AP_VLAN operation on crypto controlled devices")
      has introduced this change.
      
      Since 4addr AP operation also uses AP/VLAN iftype, this conditional
      way of advertising AP/VLAN support has broken 4addr AP mode operation on
      crypto controlled devices which do not support VLAN functionality.
      
      In the case of ath10k driver, not all firmwares have support for VLAN
      functionality but all can support 4addr AP operation. Because AP/VLAN
      support is not advertised for these devices, 4addr AP operations are
      also blocked.
      
      Fix this by allowing 4addr operation on devices which do not support
      AP/VLAN iftype but can support 4addr AP operation (decision is based on
      the wiphy flag WIPHY_FLAG_4ADDR_AP).
      
      Cc: stable@vger.kernel.org
      Fixes: db3bdcb9 ("mac80211: allow AP_VLAN operation on crypto controlled devices")
      Signed-off-by: NManikanta Pubbisetty <mpubbise@codeaurora.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      33d915d9
  19. 21 5月, 2019 1 次提交
  20. 06 2月, 2019 1 次提交
    • J
      cfg80211: pmsr: fix abort locking · 73350424
      Johannes Berg 提交于
      When we destroy the interface we already hold the wdev->mtx
      while calling cfg80211_pmsr_wdev_down(), which assumes this
      isn't true and flushes the worker that takes the lock, thus
      leading to a deadlock.
      
      Fix this by refactoring the worker and calling its code in
      cfg80211_pmsr_wdev_down() directly.
      
      We still need to flush the work later to make sure it's not
      still running and will crash, but it will not do anything.
      
      Fixes: 9bb7e0f2 ("cfg80211: add peer measurement with FTM initiator API")
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      73350424
  21. 09 11月, 2018 2 次提交
    • M
      nl80211: announce radios/interfaces when switching namespaces · c90b670b
      Martin Willi 提交于
      When a wiphy changes its namespace, all interfaces are moved to the
      new namespace as well. The network interfaces are properly announced
      as leaving on the old and as appearing on the new namespace through
      RTM_NEWLINK/RTM_DELLINK. On nl80211, however, these events are missing
      for radios and their interfaces.
      
      Add netlink announcements through nl80211 when switching namespaces,
      so userspace can rely on these events to discover radios properly.
      Signed-off-by: NMartin Willi <martin@strongswan.org>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      c90b670b
    • 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
  22. 02 10月, 2018 4 次提交
  23. 15 6月, 2018 2 次提交
  24. 23 5月, 2018 1 次提交
  25. 19 4月, 2018 1 次提交
    • J
      cfg80211: limit wiphy names to 128 bytes · a7cfebcb
      Johannes Berg 提交于
      There's currently no limit on wiphy names, other than netlink
      message size and memory limitations, but that causes issues when,
      for example, the wiphy name is used in a uevent, e.g. in rfkill
      where we use the same name for the rfkill instance, and then the
      buffer there is "only" 2k for the environment variables.
      
      This was reported by syzkaller, which used a 4k name.
      
      Limit the name to something reasonable, I randomly picked 128.
      
      Reported-by: syzbot+230d9e642a85d3fec29c@syzkaller.appspotmail.com
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      a7cfebcb
  26. 28 3月, 2018 1 次提交
  27. 20 2月, 2018 1 次提交
    • K
      net: Convert cfg80211_pernet_ops · 9c537ca1
      Kirill Tkhai 提交于
      This patch finishes converting pernet_operations
      registered in net/wireless directory.
      
      These pernet_operations have only exit method,
      which moves devices to init_net. This action
      is not pernet_operations-specific, and function
      cfg80211_switch_netns() may be called all time
      during the system life. All necessary protection
      against concurrent cfg80211_pernet_exit() is made
      by rtnl_lock(). So, cfg80211_pernet_ops is able
      to be marked as async.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9c537ca1
  28. 15 1月, 2018 1 次提交
    • J
      cfg80211: check dev_set_name() return value · 59b179b4
      Johannes Berg 提交于
      syzbot reported a warning from rfkill_alloc(), and after a while
      I think that the reason is that it was doing fault injection and
      the dev_set_name() failed, leaving the name NULL, and we didn't
      check the return value and got to rfkill_alloc() with a NULL name.
      Since we really don't want a NULL name, we ought to check the
      return value.
      
      Fixes: fb28ad35 ("net: struct device - replace bus_id with dev_name(), dev_set_name()")
      Reported-by: syzbot+1ddfb3357e1d7bb5b5d3@syzkaller.appspotmail.com
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      59b179b4
  29. 11 10月, 2017 1 次提交
    • J
      cfg80211: support loading regulatory database as firmware file · 007f6c5e
      Johannes Berg 提交于
      As the current regulatory database is only about 4k big, and already
      difficult to extend, we decided that overall it would be better to
      get rid of the complications with CRDA and load the database into the
      kernel directly, but in a new format that is extensible.
      
      The new file format can be extended since it carries a length field
      on all the structs that need to be extensible.
      
      In order to be able to request firmware when the module initializes,
      move cfg80211 from subsys_initcall() to the later fs_initcall(); the
      firmware loader is at the same level but linked earlier, so it can
      be called from there. Otherwise, when both the firmware loader and
      cfg80211 are built-in, the request will crash the kernel. We also
      need to be before device_initcall() so that cfg80211 is available
      for devices when they initialize.
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      007f6c5e
  30. 13 6月, 2017 1 次提交
  31. 28 4月, 2017 1 次提交