1. 14 12月, 2021 2 次提交
  2. 29 11月, 2021 1 次提交
  3. 26 8月, 2021 1 次提交
  4. 23 6月, 2021 2 次提交
  5. 08 4月, 2021 1 次提交
  6. 29 3月, 2021 1 次提交
  7. 12 2月, 2021 1 次提交
  8. 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
  9. 09 1月, 2021 1 次提交
  10. 11 12月, 2020 2 次提交
  11. 30 10月, 2020 1 次提交
  12. 28 9月, 2020 1 次提交
    • D
      cfg80211: regulatory: remove a bogus initialization · 735b2673
      Dan Carpenter 提交于
      The the __freq_reg_info() never returns NULL and the callers don't check
      for NULL.  This initialization to set "reg_rule = NULL;" is just there
      to make GCC happy but it's not required in current GCCs.
      
      The problem is that Smatch sees the initialization and concludes that
      this function can return NULL so it complains that the callers are not
      checking for it.
      
      Smatch used to be able to parse this correctly but we recently changed
      the code from:
      
      -       for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
      +       for (bw = MHZ_TO_KHZ(bws[i]); bw >= min_bw; bw = MHZ_TO_KHZ(bws[i--])) {
      
      Originally Smatch used to understand that this code always iterates
      through the loop once, but the change from "MHZ_TO_KHZ(20)" to
      "MHZ_TO_KHZ(bws[i])" is too complicated for Smatch.
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20200923084203.GC1454948@mwandaSigned-off-by: NJohannes Berg <johannes.berg@intel.com>
      735b2673
  13. 18 9月, 2020 1 次提交
  14. 27 8月, 2020 4 次提交
  15. 14 7月, 2020 1 次提交
  16. 24 4月, 2020 1 次提交
  17. 21 2月, 2020 1 次提交
  18. 07 2月, 2020 1 次提交
  19. 15 1月, 2020 2 次提交
  20. 08 10月, 2019 1 次提交
  21. 01 10月, 2019 1 次提交
  22. 21 8月, 2019 2 次提交
  23. 11 7月, 2019 1 次提交
  24. 28 6月, 2019 1 次提交
    • D
      keys: Replace uid/gid/perm permissions checking with an ACL · 2e12256b
      David Howells 提交于
      Replace the uid/gid/perm permissions checking on a key with an ACL to allow
      the SETATTR and SEARCH permissions to be split.  This will also allow a
      greater range of subjects to represented.
      
      ============
      WHY DO THIS?
      ============
      
      The problem is that SETATTR and SEARCH cover a slew of actions, not all of
      which should be grouped together.
      
      For SETATTR, this includes actions that are about controlling access to a
      key:
      
       (1) Changing a key's ownership.
      
       (2) Changing a key's security information.
      
       (3) Setting a keyring's restriction.
      
      And actions that are about managing a key's lifetime:
      
       (4) Setting an expiry time.
      
       (5) Revoking a key.
      
      and (proposed) managing a key as part of a cache:
      
       (6) Invalidating a key.
      
      Managing a key's lifetime doesn't really have anything to do with
      controlling access to that key.
      
      Expiry time is awkward since it's more about the lifetime of the content
      and so, in some ways goes better with WRITE permission.  It can, however,
      be set unconditionally by a process with an appropriate authorisation token
      for instantiating a key, and can also be set by the key type driver when a
      key is instantiated, so lumping it with the access-controlling actions is
      probably okay.
      
      As for SEARCH permission, that currently covers:
      
       (1) Finding keys in a keyring tree during a search.
      
       (2) Permitting keyrings to be joined.
      
       (3) Invalidation.
      
      But these don't really belong together either, since these actions really
      need to be controlled separately.
      
      Finally, there are number of special cases to do with granting the
      administrator special rights to invalidate or clear keys that I would like
      to handle with the ACL rather than key flags and special checks.
      
      
      ===============
      WHAT IS CHANGED
      ===============
      
      The SETATTR permission is split to create two new permissions:
      
       (1) SET_SECURITY - which allows the key's owner, group and ACL to be
           changed and a restriction to be placed on a keyring.
      
       (2) REVOKE - which allows a key to be revoked.
      
      The SEARCH permission is split to create:
      
       (1) SEARCH - which allows a keyring to be search and a key to be found.
      
       (2) JOIN - which allows a keyring to be joined as a session keyring.
      
       (3) INVAL - which allows a key to be invalidated.
      
      The WRITE permission is also split to create:
      
       (1) WRITE - which allows a key's content to be altered and links to be
           added, removed and replaced in a keyring.
      
       (2) CLEAR - which allows a keyring to be cleared completely.  This is
           split out to make it possible to give just this to an administrator.
      
       (3) REVOKE - see above.
      
      
      Keys acquire ACLs which consist of a series of ACEs, and all that apply are
      unioned together.  An ACE specifies a subject, such as:
      
       (*) Possessor - permitted to anyone who 'possesses' a key
       (*) Owner - permitted to the key owner
       (*) Group - permitted to the key group
       (*) Everyone - permitted to everyone
      
      Note that 'Other' has been replaced with 'Everyone' on the assumption that
      you wouldn't grant a permit to 'Other' that you wouldn't also grant to
      everyone else.
      
      Further subjects may be made available by later patches.
      
      The ACE also specifies a permissions mask.  The set of permissions is now:
      
      	VIEW		Can view the key metadata
      	READ		Can read the key content
      	WRITE		Can update/modify the key content
      	SEARCH		Can find the key by searching/requesting
      	LINK		Can make a link to the key
      	SET_SECURITY	Can change owner, ACL, expiry
      	INVAL		Can invalidate
      	REVOKE		Can revoke
      	JOIN		Can join this keyring
      	CLEAR		Can clear this keyring
      
      
      The KEYCTL_SETPERM function is then deprecated.
      
      The KEYCTL_SET_TIMEOUT function then is permitted if SET_SECURITY is set,
      or if the caller has a valid instantiation auth token.
      
      The KEYCTL_INVALIDATE function then requires INVAL.
      
      The KEYCTL_REVOKE function then requires REVOKE.
      
      The KEYCTL_JOIN_SESSION_KEYRING function then requires JOIN to join an
      existing keyring.
      
      The JOIN permission is enabled by default for session keyrings and manually
      created keyrings only.
      
      
      ======================
      BACKWARD COMPATIBILITY
      ======================
      
      To maintain backward compatibility, KEYCTL_SETPERM will translate the
      permissions mask it is given into a new ACL for a key - unless
      KEYCTL_SET_ACL has been called on that key, in which case an error will be
      returned.
      
      It will convert possessor, owner, group and other permissions into separate
      ACEs, if each portion of the mask is non-zero.
      
      SETATTR permission turns on all of INVAL, REVOKE and SET_SECURITY.  WRITE
      permission turns on WRITE, REVOKE and, if a keyring, CLEAR.  JOIN is turned
      on if a keyring is being altered.
      
      The KEYCTL_DESCRIBE function translates the ACL back into a permissions
      mask to return depending on possessor, owner, group and everyone ACEs.
      
      It will make the following mappings:
      
       (1) INVAL, JOIN -> SEARCH
      
       (2) SET_SECURITY -> SETATTR
      
       (3) REVOKE -> WRITE if SETATTR isn't already set
      
       (4) CLEAR -> WRITE
      
      Note that the value subsequently returned by KEYCTL_DESCRIBE may not match
      the value set with KEYCTL_SETATTR.
      
      
      =======
      TESTING
      =======
      
      This passes the keyutils testsuite for all but a couple of tests:
      
       (1) tests/keyctl/dh_compute/badargs: The first wrong-key-type test now
           returns EOPNOTSUPP rather than ENOKEY as READ permission isn't removed
           if the type doesn't have ->read().  You still can't actually read the
           key.
      
       (2) tests/keyctl/permitting/valid: The view-other-permissions test doesn't
           work as Other has been replaced with Everyone in the ACL.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      2e12256b
  25. 26 4月, 2019 1 次提交
    • G
      cfg80211: Use struct_size() in kzalloc() · 9f8c7136
      Gustavo A. R. Silva 提交于
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          struct boo entry[];
      };
      
      size = sizeof(struct foo) + count * sizeof(struct boo);
      instance = kzalloc(size, GFP_KERNEL)
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL)
      
      Notice that, in this case, variable size_of_regd is not necessary,
      hence it is removed.
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      9f8c7136
  26. 23 4月, 2019 1 次提交
  27. 29 3月, 2019 1 次提交
  28. 11 2月, 2019 1 次提交
    • J
      cfg80211: restore regulatory without calling userspace · e646a025
      Johannes Berg 提交于
      Jouni reports that in some cases it is possible that getting
      disconnected (or stopping AP, after previous patches) results
      in further operations hitting the window within the regulatory
      core restoring the regdomain to the defaults. The reason for
      this is that we have to call out to CRDA or otherwise do some
      asynchronous work, and thus can't do the restore atomically.
      
      However, we've previously seen all the data we need to do the
      restore, so we can hang on to that data and use it later for
      the restore. This makes the whole thing happen within a single
      locked section and thus atomic.
      
      However, we can't *always* do this - there are unfortunately
      cases where the restore needs to re-request, because this is
      also used (abused?) as an error recovery process, so make the
      new behaviour optional and only use it when doing a regular
      restore as described above.
      Reported-by: NJouni Malinen <j@w1.fi>
      Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
      e646a025
  29. 25 1月, 2019 3 次提交
  30. 02 10月, 2018 1 次提交