mac80211: check skb_linearize() return value
authorJohannes Berg <johannes.berg@intel.com>
Wed, 14 Sep 2016 07:41:34 +0000 (09:41 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 14 Sep 2016 10:08:33 +0000 (12:08 +0200)
The A-MSDU TX code (within TXQs) didn't always check the return value
of skb_linearize() properly, resulting in potentially passing a frag-
list SKB down to the driver even when it said it can't handle it. Fix
that.

Fixes: 6e0456b545456 ("mac80211: add A-MSDU tx support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/tx.c

index cc8e95554b4888422cb15a7333fc368e33a957c7..18b285e06bc89af3393fd35d30e4ed02e4e433cb 100644 (file)
@@ -1515,8 +1515,12 @@ out:
        spin_unlock_bh(&fq->lock);
 
        if (skb && skb_has_frag_list(skb) &&
-           !ieee80211_hw_check(&local->hw, TX_FRAG_LIST))
-               skb_linearize(skb);
+           !ieee80211_hw_check(&local->hw, TX_FRAG_LIST)) {
+               if (skb_linearize(skb)) {
+                       ieee80211_free_txskb(&local->hw, skb);
+                       return NULL;
+               }
+       }
 
        return skb;
 }