Commit ca48aa4a authored by David S. Miller's avatar David S. Miller

Merge tag 'mac80211-for-net-2021-09-27' of...

Merge tag 'mac80211-for-net-2021-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211

Johannes berg says:

====================
Some fixes:
 * potential use-after-free in CCMP/GCMP RX processing
 * potential use-after-free in TX A-MSDU processing
 * revert to low data rates for no-ack as the commit
   broke other things
 * limit VHT MCS/NSS in radiotap injection
 * drop frames with invalid addresses in IBSS mode
 * check rhashtable_init() return value in mesh
 * fix potentially unaligned access in mesh
 * fix late beacon hrtimer handling in hwsim (syzbot)
 * fix documentation for PTK0 rekeying
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 3ebaaad4 33092aca
...@@ -1867,8 +1867,8 @@ mac80211_hwsim_beacon(struct hrtimer *timer) ...@@ -1867,8 +1867,8 @@ mac80211_hwsim_beacon(struct hrtimer *timer)
bcn_int -= data->bcn_delta; bcn_int -= data->bcn_delta;
data->bcn_delta = 0; data->bcn_delta = 0;
} }
hrtimer_forward(&data->beacon_timer, hrtimer_get_expires(timer), hrtimer_forward_now(&data->beacon_timer,
ns_to_ktime(bcn_int * NSEC_PER_USEC)); ns_to_ktime(bcn_int * NSEC_PER_USEC));
return HRTIMER_RESTART; return HRTIMER_RESTART;
} }
......
...@@ -2818,13 +2818,13 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb); ...@@ -2818,13 +2818,13 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
* Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag * Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag
* when they are able to replace in-use PTK keys according to the following * when they are able to replace in-use PTK keys according to the following
* requirements: * requirements:
* 1) They do not hand over frames decrypted with the old key to * 1) They do not hand over frames decrypted with the old key to mac80211
mac80211 once the call to set_key() with command %DISABLE_KEY has been once the call to set_key() with command %DISABLE_KEY has been completed,
completed when also setting @IEEE80211_KEY_FLAG_GENERATE_IV for any key,
2) either drop or continue to use the old key for any outgoing frames queued 2) either drop or continue to use the old key for any outgoing frames queued
at the time of the key deletion (including re-transmits), at the time of the key deletion (including re-transmits),
3) never send out a frame queued prior to the set_key() %SET_KEY command 3) never send out a frame queued prior to the set_key() %SET_KEY command
encrypted with the new key and encrypted with the new key when also needing
@IEEE80211_KEY_FLAG_GENERATE_IV and
4) never send out a frame unencrypted when it should be encrypted. 4) never send out a frame unencrypted when it should be encrypted.
Mac80211 will not queue any new frames for a deleted key to the driver. Mac80211 will not queue any new frames for a deleted key to the driver.
*/ */
......
...@@ -60,7 +60,10 @@ static struct mesh_table *mesh_table_alloc(void) ...@@ -60,7 +60,10 @@ static struct mesh_table *mesh_table_alloc(void)
atomic_set(&newtbl->entries, 0); atomic_set(&newtbl->entries, 0);
spin_lock_init(&newtbl->gates_lock); spin_lock_init(&newtbl->gates_lock);
spin_lock_init(&newtbl->walk_lock); spin_lock_init(&newtbl->walk_lock);
rhashtable_init(&newtbl->rhead, &mesh_rht_params); if (rhashtable_init(&newtbl->rhead, &mesh_rht_params)) {
kfree(newtbl);
return NULL;
}
return newtbl; return newtbl;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* /*
* Copyright 2012-2013, Marco Porsch <marco.porsch@s2005.tu-chemnitz.de> * Copyright 2012-2013, Marco Porsch <marco.porsch@s2005.tu-chemnitz.de>
* Copyright 2012-2013, cozybit Inc. * Copyright 2012-2013, cozybit Inc.
* Copyright (C) 2021 Intel Corporation
*/ */
#include "mesh.h" #include "mesh.h"
...@@ -588,7 +589,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta, ...@@ -588,7 +589,7 @@ void ieee80211_mps_frame_release(struct sta_info *sta,
/* only transmit to PS STA with announced, non-zero awake window */ /* only transmit to PS STA with announced, non-zero awake window */
if (test_sta_flag(sta, WLAN_STA_PS_STA) && if (test_sta_flag(sta, WLAN_STA_PS_STA) &&
(!elems->awake_window || !le16_to_cpu(*elems->awake_window))) (!elems->awake_window || !get_unaligned_le16(elems->awake_window)))
return; return;
if (!test_sta_flag(sta, WLAN_STA_MPSP_OWNER)) if (!test_sta_flag(sta, WLAN_STA_MPSP_OWNER))
......
...@@ -392,10 +392,6 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta, ...@@ -392,10 +392,6 @@ static bool rate_control_send_low(struct ieee80211_sta *pubsta,
int mcast_rate; int mcast_rate;
bool use_basicrate = false; bool use_basicrate = false;
if (ieee80211_is_tx_data(txrc->skb) &&
info->flags & IEEE80211_TX_CTL_NO_ACK)
return false;
if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) { if (!pubsta || rc_no_data_or_no_ack_use_min(txrc)) {
__rate_control_send_low(txrc->hw, sband, pubsta, info, __rate_control_send_low(txrc->hw, sband, pubsta, info,
txrc->rate_idx_mask); txrc->rate_idx_mask);
......
...@@ -4131,7 +4131,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx) ...@@ -4131,7 +4131,8 @@ static bool ieee80211_accept_frame(struct ieee80211_rx_data *rx)
if (!bssid) if (!bssid)
return false; return false;
if (ether_addr_equal(sdata->vif.addr, hdr->addr2) || if (ether_addr_equal(sdata->vif.addr, hdr->addr2) ||
ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2)) ether_addr_equal(sdata->u.ibss.bssid, hdr->addr2) ||
!is_valid_ether_addr(hdr->addr2))
return false; return false;
if (ieee80211_is_beacon(hdr->frame_control)) if (ieee80211_is_beacon(hdr->frame_control))
return true; return true;
......
...@@ -2209,7 +2209,11 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb, ...@@ -2209,7 +2209,11 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
} }
vht_mcs = iterator.this_arg[4] >> 4; vht_mcs = iterator.this_arg[4] >> 4;
if (vht_mcs > 11)
vht_mcs = 0;
vht_nss = iterator.this_arg[4] & 0xF; vht_nss = iterator.this_arg[4] & 0xF;
if (!vht_nss || vht_nss > 8)
vht_nss = 1;
break; break;
/* /*
...@@ -3380,6 +3384,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata, ...@@ -3380,6 +3384,14 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head)) if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
goto out; goto out;
/* If n == 2, the "while (*frag_tail)" loop above didn't execute
* and frag_tail should be &skb_shinfo(head)->frag_list.
* However, ieee80211_amsdu_prepare_head() can reallocate it.
* Reload frag_tail to have it pointing to the correct place.
*/
if (n == 2)
frag_tail = &skb_shinfo(head)->frag_list;
/* /*
* Pad out the previous subframe to a multiple of 4 by adding the * Pad out the previous subframe to a multiple of 4 by adding the
* padding to the next one, that's being added. Note that head->len * padding to the next one, that's being added. Note that head->len
......
...@@ -520,6 +520,9 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx, ...@@ -520,6 +520,9 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx,
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
/* reload hdr - skb might have been reallocated */
hdr = (void *)rx->skb->data;
data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len; data_len = skb->len - hdrlen - IEEE80211_CCMP_HDR_LEN - mic_len;
if (!rx->sta || data_len < 0) if (!rx->sta || data_len < 0)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
...@@ -749,6 +752,9 @@ ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx) ...@@ -749,6 +752,9 @@ ieee80211_crypto_gcmp_decrypt(struct ieee80211_rx_data *rx)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
} }
/* reload hdr - skb might have been reallocated */
hdr = (void *)rx->skb->data;
data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN - mic_len; data_len = skb->len - hdrlen - IEEE80211_GCMP_HDR_LEN - mic_len;
if (!rx->sta || data_len < 0) if (!rx->sta || data_len < 0)
return RX_DROP_UNUSABLE; return RX_DROP_UNUSABLE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment