Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/net/mac80211/debugfs_sta.c b/net/mac80211/debugfs_sta.c
- index c80b1e163ea4..3419ed66c7b0 100644
- --- a/net/mac80211/debugfs_sta.c
- +++ b/net/mac80211/debugfs_sta.c
- @@ -5,7 +5,7 @@
- * Copyright 2007 Johannes Berg <[email protected]>
- * Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright(c) 2016 Intel Deutschland GmbH
- - * Copyright (C) 2018 - 2019 Intel Corporation
- + * Copyright (C) 2018 - 2020 Intel Corporation
- */
- #include <linux/debugfs.h>
- @@ -78,6 +78,7 @@ static const char * const sta_flag_names[] = {
- FLAG(MPSP_OWNER),
- FLAG(MPSP_RECIPIENT),
- FLAG(PS_DELIVER),
- + FLAG(USES_ENCRYPTION),
- #undef FLAG
- };
- diff --git a/net/mac80211/key.c b/net/mac80211/key.c
- index 0f889b919b06..efc1acc6543c 100644
- --- a/net/mac80211/key.c
- +++ b/net/mac80211/key.c
- @@ -6,7 +6,7 @@
- * Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright 2015-2017 Intel Deutschland GmbH
- - * Copyright 2018-2019 Intel Corporation
- + * Copyright 2018-2020 Intel Corporation
- */
- #include <linux/if_ether.h>
- @@ -262,22 +262,29 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
- sta ? sta->sta.addr : bcast_addr, ret);
- }
- -int ieee80211_set_tx_key(struct ieee80211_key *key)
- +static int _ieee80211_set_tx_key(struct ieee80211_key *key, bool force)
- {
- struct sta_info *sta = key->sta;
- struct ieee80211_local *local = key->local;
- assert_key_lock(local);
- + set_sta_flag(sta, WLAN_STA_USES_ENCRYPTION);
- +
- sta->ptk_idx = key->conf.keyidx;
- - if (!ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
- + if (force || !ieee80211_hw_check(&local->hw, AMPDU_KEYBORDER_SUPPORT))
- clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
- ieee80211_check_fast_xmit(sta);
- return 0;
- }
- +int ieee80211_set_tx_key(struct ieee80211_key *key)
- +{
- + return _ieee80211_set_tx_key(key, false);
- +}
- +
- static void ieee80211_pairwise_rekey(struct ieee80211_key *old,
- struct ieee80211_key *new)
- {
- @@ -441,11 +448,8 @@ static int ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
- if (pairwise) {
- rcu_assign_pointer(sta->ptk[idx], new);
- if (new &&
- - !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX)) {
- - sta->ptk_idx = idx;
- - clear_sta_flag(sta, WLAN_STA_BLOCK_BA);
- - ieee80211_check_fast_xmit(sta);
- - }
- + !(new->conf.flags & IEEE80211_KEY_FLAG_NO_AUTO_TX))
- + _ieee80211_set_tx_key(new, true);
- } else {
- rcu_assign_pointer(sta->gtk[idx], new);
- }
- diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
- index c00e28585f9d..552eed36faca 100644
- --- a/net/mac80211/sta_info.h
- +++ b/net/mac80211/sta_info.h
- @@ -98,6 +98,7 @@ enum ieee80211_sta_info_flags {
- WLAN_STA_MPSP_OWNER,
- WLAN_STA_MPSP_RECIPIENT,
- WLAN_STA_PS_DELIVER,
- + WLAN_STA_USES_ENCRYPTION,
- NUM_WLAN_STA_FLAGS,
- };
- diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
- index 87def9cb91ff..7dbfb9e3cd84 100644
- --- a/net/mac80211/tx.c
- +++ b/net/mac80211/tx.c
- @@ -590,10 +590,13 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
- struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
- - if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT))
- + if (unlikely(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT)) {
- tx->key = NULL;
- - else if (tx->sta &&
- - (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
- + return TX_CONTINUE;
- + }
- +
- + if (tx->sta &&
- + (key = rcu_dereference(tx->sta->ptk[tx->sta->ptk_idx])))
- tx->key = key;
- else if (ieee80211_is_group_privacy_action(tx->skb) &&
- (key = rcu_dereference(tx->sdata->default_multicast_key)))
- @@ -654,6 +657,9 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
- if (!skip_hw && tx->key &&
- tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)
- info->control.hw_key = &tx->key->conf;
- + } else if (!ieee80211_is_mgmt(hdr->frame_control) && tx->sta &&
- + test_sta_flag(tx->sta, WLAN_STA_USES_ENCRYPTION)) {
- + return TX_DROP;
- }
- return TX_CONTINUE;
- diff --git a/net/wireless/scan.c b/net/wireless/scan.c
- index aef240fdf8df..328402ab64a3 100644
- --- a/net/wireless/scan.c
- +++ b/net/wireless/scan.c
- @@ -2022,7 +2022,11 @@ void cfg80211_update_assoc_bss_entry(struct wireless_dev *wdev,
- spin_lock_bh(&rdev->bss_lock);
- - if (WARN_ON(cbss->pub.channel == chan))
- + /*
- + * Some APs use CSA also for bandwidth changes, i.e., without actually
- + * changing the control channel, so no need to update in such a case.
- + */
- + if (cbss->pub.channel == chan)
- goto done;
- /* use transmitting bss */
- diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
- index 7dbfb9e3cd84..455eb8e6a459 100644
- --- a/net/mac80211/tx.c
- +++ b/net/mac80211/tx.c
- @@ -3604,8 +3604,25 @@ begin:
- tx.skb = skb;
- tx.sdata = vif_to_sdata(info->control.vif);
- - if (txq->sta)
- + if (txq->sta) {
- tx.sta = container_of(txq->sta, struct sta_info, sta);
- + /*
- + * Drop unicast frames to unauthorised stations unless they are
- + * EAPOL frames from the local station.
- + */
- + if (unlikely(!ieee80211_vif_is_mesh(&tx.sdata->vif) &&
- + tx.sdata->vif.type != NL80211_IFTYPE_OCB &&
- + !is_multicast_ether_addr(hdr->addr1) &&
- + !test_sta_flag(tx.sta, WLAN_STA_AUTHORIZED) &&
- + (!(info->control.flags &
- + IEEE80211_TX_CTRL_PORT_CTRL_PROTO) ||
- + !ether_addr_equal(tx.sdata->vif.addr,
- + hdr->addr2)))) {
- + I802_DEBUG_INC(local->tx_handlers_drop_unauth_port);
- + ieee80211_free_txskb(&local->hw, skb);
- + goto begin;
- + }
- + }
- /*
- * The key can be removed while the packet was queued, so need to call
- diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
- index 0f5f40678885..e3572be307d6 100644
- --- a/net/mac80211/sta_info.c
- +++ b/net/mac80211/sta_info.c
- @@ -4,7 +4,7 @@
- * Copyright 2013-2014 Intel Mobile Communications GmbH
- * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
- - * Copyright (C) 2018-2019 Intel Corporation
- + * Copyright (C) 2018-2020 Intel Corporation
- */
- #include <linux/module.h>
- @@ -1049,6 +1049,11 @@ static void __sta_info_destroy_part2(struct sta_info *sta)
- might_sleep();
- lockdep_assert_held(&local->sta_mtx);
- + while (sta->sta_state == IEEE80211_STA_AUTHORIZED) {
- + ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
- + WARN_ON_ONCE(ret);
- + }
- +
- /* now keys can no longer be reached */
- ieee80211_free_sta_keys(local, sta);
- diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
- index 455eb8e6a459..d9cca6dbd870 100644
- --- a/net/mac80211/tx.c
- +++ b/net/mac80211/tx.c
- @@ -5,7 +5,7 @@
- * Copyright 2007 Johannes Berg <[email protected]>
- * Copyright 2013-2014 Intel Mobile Communications GmbH
- - * Copyright (C) 2018 Intel Corporation
- + * Copyright (C) 2018, 2020 Intel Corporation
- *
- * Transmit and frame generation functions.
- */
- @@ -5149,6 +5149,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
- struct ieee80211_local *local = sdata->local;
- struct sk_buff *skb;
- struct ethhdr *ehdr;
- + u32 ctrl_flags = 0;
- u32 flags;
- /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
- @@ -5158,6 +5159,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
- proto != cpu_to_be16(ETH_P_PREAUTH))
- return -EINVAL;
- + if (proto == sdata->control_port_protocol)
- + ctrl_flags |= IEEE80211_TX_CTRL_PORT_CTRL_PROTO;
- +
- if (unencrypted)
- flags = IEEE80211_TX_INTFL_DONT_ENCRYPT;
- else
- @@ -5183,7 +5187,7 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
- skb_reset_mac_header(skb);
- local_bh_disable();
- - __ieee80211_subif_start_xmit(skb, skb->dev, flags, 0);
- + __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags);
- local_bh_enable();
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment