aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-01-02 05:19:29 -0500
committerJohannes Berg <johannes.berg@intel.com>2017-01-02 05:28:25 -0500
commit35f432a03e41d3bf08c51ede917f94e2288fbe8c (patch)
tree67eed715e449fb7460f834c32edf723f2b4efa05
parenteb7903bb83cc1db31a9124d4cc8a1bddebe26e33 (diff)
mac80211: initialize fast-xmit 'info' later
In ieee80211_xmit_fast(), 'info' is initialized to point to the skb that's passed in, but that skb may later be replaced by a clone (if it was shared), leading to an invalid pointer. This can lead to use-after-free and also later crashes since the real SKB's info->hw_queue doesn't get initialized properly. Fix this by assigning info only later, when it's needed, after the skb replacement (may have) happened. Cc: stable@vger.kernel.org Reported-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/tx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 2c21b7039136..0d8b716e509e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3287,7 +3287,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2); 3287 int extra_head = fast_tx->hdr_len - (ETH_HLEN - 2);
3288 int hw_headroom = sdata->local->hw.extra_tx_headroom; 3288 int hw_headroom = sdata->local->hw.extra_tx_headroom;
3289 struct ethhdr eth; 3289 struct ethhdr eth;
3290 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 3290 struct ieee80211_tx_info *info;
3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr; 3291 struct ieee80211_hdr *hdr = (void *)fast_tx->hdr;
3292 struct ieee80211_tx_data tx; 3292 struct ieee80211_tx_data tx;
3293 ieee80211_tx_result r; 3293 ieee80211_tx_result r;
@@ -3351,6 +3351,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN); 3351 memcpy(skb->data + fast_tx->da_offs, eth.h_dest, ETH_ALEN);
3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN); 3352 memcpy(skb->data + fast_tx->sa_offs, eth.h_source, ETH_ALEN);
3353 3353
3354 info = IEEE80211_SKB_CB(skb);
3354 memset(info, 0, sizeof(*info)); 3355 memset(info, 0, sizeof(*info));
3355 info->band = fast_tx->band; 3356 info->band = fast_tx->band;
3356 info->control.vif = &sdata->vif; 3357 info->control.vif = &sdata->vif;