1. 07 6月, 2018 1 次提交
    • K
      treewide: Use struct_size() for kmalloc()-family · acafe7e3
      Kees Cook 提交于
      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;
          void *entry[];
      };
      
      instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
      uses. It was done via automatic conversion with manual review for the
      "CHECKME" non-standard cases noted below, using the following Coccinelle
      script:
      
      // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
      //                      sizeof *pkey_cache->table, GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      identifier VAR, ELEMENT;
      expression COUNT;
      @@
      
      - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
      + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)
      
      // Same pattern, but can't trivially locate the trailing element name,
      // or variable name.
      @@
      identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
      expression GFP;
      expression SOMETHING, COUNT, ELEMENT;
      @@
      
      - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
      + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)
      Signed-off-by: NKees Cook <keescook@chromium.org>
      acafe7e3
  2. 30 5月, 2018 1 次提交
  3. 23 5月, 2018 1 次提交
  4. 20 4月, 2018 1 次提交
  5. 09 4月, 2018 1 次提交
  6. 29 3月, 2018 2 次提交
    • I
      iwlwifi: mvm: Allow iwl_mvm_mac_mgd_prepare_tx() when associated · d270e7b8
      Ilan Peer 提交于
      The FW does not allocate quota air time for the binding of a station
      MAC before iwlmvm indicates that it is associated. Currently iwlmvm
      indicates that the MAC is associated only after hearing a beacon from
      the AP. In case a deauthentication frame is sent before the MAC is
      associated, the frame might not be sent as the corresponding binding
      is not scheduled.
      
      To handle such cases, set IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP in the
      HW flags, requesting mac80211 to call the mgd_prepare_tx() callback
      before transmitting a deauthentication frame if associated but no
      beacon was heard from the AP.
      
      In addition, do not warn in iwl_mvm_mac_mgd_prepare_tx() when already
      associated as now the callback can be called also when associated.
      Signed-off-by: NIlan Peer <ilan.peer@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      d270e7b8
    • Z
      iwlwifi: mvm: add support for oce · 8f691af9
      Zamir, Roee 提交于
      Add support for Optimized Connectivity Experience (OCE).  Get
      capabilities from the fw, expose them with nl80211, and enable them in
      UMAC scan if the relevant nl80211 flags are set by the userspace.
      Signed-off-by: NRoee Zamir <roee.zamir@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      8f691af9
  7. 19 3月, 2018 1 次提交
    • A
      iwlwifi: mvm: Increase session protection time after CS · 19125cb0
      Andrei Otcheretianski 提交于
      After switching to a new channel, driver schedules session protection
      time event in order to hear the beacon on the new channel.
      The duration of the protection is two beacon intervals.
      However, since we start to switch slightly before beacon with count 1, in
      case we don't hear (or AP doesn't transmit) the very first beacon on the
      new channel the protection ends without hearing any beacon at all.
      At this stage the switch is not complete, the queues are closed and the
      interface doesn't have quota yet or TBTT events. As the result, we are
      stuck forever waiting for iwl_mvm_post_channel_switch() to be called.
      
      Fix this by increasing the protection time to be 3 beacon intervals and
      in addition drop the connection if the time event ends before we got any
      beacon.
      Signed-off-by: NAndrei Otcheretianski <andrei.otcheretianski@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      19125cb0
  8. 16 3月, 2018 1 次提交
  9. 02 3月, 2018 1 次提交
  10. 16 2月, 2018 1 次提交
  11. 21 12月, 2017 2 次提交
  12. 06 12月, 2017 3 次提交
  13. 28 11月, 2017 2 次提交
  14. 25 11月, 2017 1 次提交
  15. 03 11月, 2017 4 次提交
  16. 06 10月, 2017 4 次提交
  17. 08 9月, 2017 4 次提交
  18. 30 8月, 2017 1 次提交
    • D
      iwlwifi: mvm: Avoid deferring non bufferable frames · eb045e6e
      David Spinadel 提交于
      Use bcast station for all non bufferable frames on AP and AD-HOC.
      
      The host is no longer aware of STAs PS status because of buffer
      station offload, so we can't rely on mac80211 to toggle on
      IEEE80211_TX_CTL_NO_PS_BUFFER bit.
      
      A possible issue with buffering such frames, beside the obvious spec
      violation, is when a station disconnects while in PS but the AP isn't
      aware of that. In such scenarios the AP won't be able to send probe
      responses or auth frames so the STA won't be able to reconnect and
      the AP will have a queue hang.
      
      Fixes: 3e56eadf ("iwlwifi: mvm: implement AP/GO uAPSD support")
      Signed-off-by: NDavid Spinadel <david.spinadel@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      eb045e6e
  19. 18 8月, 2017 2 次提交
  20. 09 8月, 2017 1 次提交
    • A
      iwlwifi: mvm: start mac queues when deferred tx frames are purged · 7e39a00d
      Avraham Stern 提交于
      In AP mode, if a station is removed just as it is adding a new stream,
      the queue in question will remain stopped and no more TX will happen
      in this queue, leading to connection failures and other problems.
      
      This is because under DQA, when tx is deferred because a queue needs
      to be allocated, the mac queue for that TID is stopped until the new
      stream is added.  If at this point the station that this stream
      belongs to is removed, all the deferred tx frames are purged, but the
      mac queue is not restarted. As a result, all following tx on this
      queue will not be transmitted.
      
      Fix this by starting the relevant mac queues when the deferred tx
      frames are purged.
      
      Fixes: 24afba76 ("iwlwifi: mvm: support bss dynamic alloc/dealloc of queues")
      Signed-off-by: NAvraham Stern <avraham.stern@intel.com>
      Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
      7e39a00d
  21. 01 8月, 2017 5 次提交