mac80211: free skb fraglist before freeing the skb
authorSara Sharon <sara.sharon@intel.com>
Sat, 15 Dec 2018 09:03:06 +0000 (11:03 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 19 Dec 2018 08:40:17 +0000 (09:40 +0100)
mac80211 uses the frag list to build AMSDU. When freeing
the skb, it may not be really freed, since someone is still
holding a reference to it.
In that case, when TCP skb is being retransmitted, the
pointer to the frag list is being reused, while the data
in there is no longer valid.
Since we will never get frag list from the network stack,
as mac80211 doesn't advertise the capability, we can safely
free and nullify it before releasing the SKB.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/status.c

index a794ca7290001a778d7ef5fde62a7c32b7c110b1..3f0b96e1e02fa572bde737a0cc3f98967fe8ac0f 100644 (file)
@@ -556,6 +556,11 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
        }
 
        ieee80211_led_tx(local);
+
+       if (skb_has_frag_list(skb)) {
+               kfree_skb_list(skb_shinfo(skb)->frag_list);
+               skb_shinfo(skb)->frag_list = NULL;
+       }
 }
 
 /*