Guest User

iwlwifi linux 5.6.1

a guest
Apr 1st, 2020
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 7.92 KB | None | 0 0
  1. diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
  2. index c80b1e163ea4..3419ed66c7b0 100644
  3. --- a/net/mac80211/debugfs_sta.c
  4. +++ b/net/mac80211/debugfs_sta.c
  5. @@ -5,7 +5,7 @@
  6.   * Copyright 2007  Johannes Berg <[email protected]>
  7.   * Copyright 2013-2014  Intel Mobile Communications GmbH
  8.   * Copyright(c) 2016 Intel Deutschland GmbH
  9. - * Copyright (C) 2018 - 2019 Intel Corporation
  10. + * Copyright (C) 2018 - 2020 Intel Corporation
  11.   */
  12.  
  13.  #include <linux/debugfs.h>
  14. @@ -78,6 +78,7 @@ static const char * const sta_flag_names[] = {
  15.     FLAG(MPSP_OWNER),
  16.     FLAG(MPSP_RECIPIENT),
  17.     FLAG(PS_DELIVER),
  18. +   FLAG(USES_ENCRYPTION),
  19.  #undef FLAG
  20.  };
  21.  
  22. diff --git a/net/mac80211/key.c b/net/mac80211/key.c
  23. index 0f889b919b06..efc1acc6543c 100644
  24. --- a/net/mac80211/key.c
  25. +++ b/net/mac80211/key.c
  26. @@ -6,7 +6,7 @@
  27.   * Copyright 2007-2008 Johannes Berg <[email protected]>
  28.   * Copyright 2013-2014  Intel Mobile Communications GmbH
  29.   * Copyright 2015-2017 Intel Deutschland GmbH
  30. - * Copyright 2018-2019  Intel Corporation
  31. + * Copyright 2018-2020  Intel Corporation
  32.   */
  33.  
  34.  #include <linux/if_ether.h>
  35. @@ -262,22 +262,29 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
  36.               sta ? sta->sta.addr : bcast_addr, ret);
  37.  }
  38.  
  39. -int ieee80211_set_tx_key(struct ieee80211_key *key)
  40. +static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force)
  41.  {
  42.     struct sta_info *sta = key->sta;
  43.     struct ieee80211_local *local = key->local;
  44.  
  45.     assert_key_lock(local);
  46.  
  47. +   set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION);
  48. +
  49.     sta->ptk_idx = key->conf.keyidx;
  50.  
  51. -   if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
  52. +   if (force || !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
  53.         clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
  54.     ieee80211_check_fast_xmit(sta);
  55.  
  56.     return 0;
  57.  }
  58.  
  59. +int ieee80211_set_tx_key(struct ieee80211_key *key)
  60. +{
  61. +   return _ieee80211_set_tx_key(key, false);
  62. +}
  63. +
  64.  static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
  65.                      struct ieee80211_key *new)
  66.  {
  67. @@ -441,11 +448,8 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
  68.         if (pairwise) {
  69.             rcu_assign_pointer(sta->ptk[idx], new);
  70.             if (new &&
  71. -               !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) {
  72. -               sta->ptk_idx = idx;
  73. -               clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
  74. -               ieee80211_check_fast_xmit(sta);
  75. -           }
  76. +               !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX))
  77. +               _ieee80211_set_tx_key(new, true);
  78.         } else {
  79.             rcu_assign_pointer(sta->gtk[idx], new);
  80.         }
  81. diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
  82. index c00e28585f9d..552eed36faca 100644
  83. --- a/net/mac80211/sta_info.h
  84. +++ b/net/mac80211/sta_info.h
  85. @@ -98,6 +98,7 @@ enum ieee80211_sta_info_flags {
  86.     WLAN_STA_MPSP_OWNER,
  87.     WLAN_STA_MPSP_RECIPIENT,
  88.     WLAN_STA_PS_DELIVER,
  89. +   WLAN_STA_USES_ENCRYPTION,
  90.  
  91.     NUM_WLAN_STA_FLAGS,
  92.  };
  93. diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
  94. index 87def9cb91ff..7dbfb9e3cd84 100644
  95. --- a/net/mac80211/tx.c
  96. +++ b/net/mac80211/tx.c
  97. @@ -590,10 +590,13 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
  98.     struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
  99.     struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
  100.  
  101. -   if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT))
  102. +   if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) {
  103.         tx->key = NULL;
  104. -   else if (tx->sta &&
  105. -        (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
  106. +       return TX_CONTINUE;
  107. +   }
  108. +
  109. +   if (tx->sta &&
  110. +       (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
  111.         tx->key = key;
  112.     else if (ieee80211_is_group_privacy_action(tx->skb) &&
  113.         (key = rcu_dereference(tx->sdata->default_multicast_key)))
  114. @@ -654,6 +657,9 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
  115.         if (!skip_hw && tx->key &&
  116.             tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
  117.             info->control.hw_key = &tx->key->conf;
  118. +   } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta &&
  119. +          test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
  120. +       return TX_DROP;
  121.     }
  122.  
  123.     return TX_CONTINUE;
  124.  
  125. diff --git a/net/wireless/scan.c b/net/wireless/scan.c
  126. index aef240fdf8df..328402ab64a3 100644
  127. --- a/net/wireless/scan.c
  128. +++ b/net/wireless/scan.c
  129. @@ -2022,7 +2022,11 @@ void cfg80211_update_assoc_bss_entry(struct wireless_dev *wdev,
  130.  
  131.     spin_lock_bh(&rdev->bss_lock);
  132.  
  133. -   if (WARN_ON(cbss->pub.channel == chan))
  134. +   /*
  135. +    * Some APs use CSA also for bandwidth changes, i.e., without actually
  136. +    * changing the control channel, so no need to update in such a case.
  137. +    */
  138. +   if (cbss->pub.channel == chan)
  139.         goto done;
  140.  
  141.     /* use transmitting bss */
  142.  
  143.  
  144. diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
  145. index 7dbfb9e3cd84..455eb8e6a459 100644
  146. --- a/net/mac80211/tx.c
  147. +++ b/net/mac80211/tx.c
  148. @@ -3604,8 +3604,25 @@ begin:
  149.     tx.skb = skb;
  150.     tx.sdata = vif_to_sdata(info->control.vif);
  151.  
  152. -   if (txq->sta)
  153. +   if (txq->sta) {
  154.         tx.sta = container_of(txq->sta, struct sta_info, sta);
  155. +       /*
  156. +        * Drop unicast frames to unauthorised stations unless they are
  157. +        * EAPOL frames from the local station.
  158. +        */
  159. +       if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
  160. +                tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
  161. +                !is_multicast_ether_addr(hdr->addr1) &&
  162. +                !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
  163. +                (!(info->control.flags &
  164. +               IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
  165. +                 !ether_addr_equal(tx.sdata->vif.addr,
  166. +                       hdr->addr2)))) {
  167. +           I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
  168. +           ieee80211_free_txskb(&local->hw, skb);
  169. +           goto begin;
  170. +       }
  171. +   }
  172.  
  173.     /*
  174.      * The key can be removed while the packet was queued, so need to call
  175.  
  176. diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
  177. index 0f5f40678885..e3572be307d6 100644
  178. --- a/net/mac80211/sta_info.c
  179. +++ b/net/mac80211/sta_info.c
  180. @@ -4,7 +4,7 @@
  181.   * Copyright 2006-2007 Jiri Benc <[email protected]>
  182.   * Copyright 2013-2014  Intel Mobile Communications GmbH
  183.   * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
  184. - * Copyright (C) 2018-2019 Intel Corporation
  185. + * Copyright (C) 2018-2020 Intel Corporation
  186.   */
  187.  
  188.  #include <linux/module.h>
  189. @@ -1049,6 +1049,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta)
  190.     might_sleep();
  191.     lockdep_assert_held(&local->sta_mtx);
  192.  
  193. +   while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
  194. +       ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
  195. +       WARN_ON_ONCE(ret);
  196. +   }
  197. +
  198.     /* now keys can no longer be reached */
  199.     ieee80211_free_sta_keys(local, sta);
  200.  
  201.  
  202. diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
  203. index 455eb8e6a459..d9cca6dbd870 100644
  204. --- a/net/mac80211/tx.c
  205. +++ b/net/mac80211/tx.c
  206. @@ -5,7 +5,7 @@
  207.   * Copyright 2006-2007 Jiri Benc <[email protected]>
  208.   * Copyright 2007  Johannes Berg <[email protected]>
  209.   * Copyright 2013-2014  Intel Mobile Communications GmbH
  210. - * Copyright (C) 2018 Intel Corporation
  211. + * Copyright (C) 2018, 2020 Intel Corporation
  212.   *
  213.   * Transmit and frame generation functions.
  214.   */
  215. @@ -5149,6 +5149,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
  216.     struct ieee80211_local *local = sdata->local;
  217.     struct sk_buff *skb;
  218.     struct ethhdr *ehdr;
  219. +   u32 ctrl_flags = 0;
  220.     u32 flags;
  221.  
  222.     /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
  223. @@ -5158,6 +5159,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
  224.         proto != cpu_to_be16(ETH_P_PREAUTH))
  225.         return -EINVAL;
  226.  
  227. +   if (proto == sdata->control_port_protocol)
  228. +       ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
  229. +
  230.     if (unencrypted)
  231.         flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
  232.     else
  233. @@ -5183,7 +5187,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
  234.     skb_reset_mac_header(skb);
  235.  
  236.     local_bh_disable();
  237. -   __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
  238. +   __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
  239.     local_bh_enable();
  240.  
  241.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment