351-mac80211-free-skb-fraglist-before-freeing-the-skb.patch 938 B

12345678910111213141516171819202122232425262728293031
  1. From: Sara Sharon <sara.sharon@intel.com>
  2. Date: Thu, 11 Oct 2018 14:21:21 +0200
  3. Subject: [PATCH] mac80211: free skb fraglist before freeing the skb
  4. mac80211 uses the frag list to build AMSDU. When freeing
  5. the skb, it may not be really freed, since someone is still
  6. holding a reference to it.
  7. In that case, when TCP skb is being retransmitted, the
  8. pointer to the frag list is being reused, while the data
  9. in there is no longer valid.
  10. Since we will never get frag list from the network stack,
  11. as mac80211 doesn't advertise the capability, we can safely
  12. free and nullify it before releasing the SKB.
  13. Signed-off-by: Sara Sharon <sara.sharon@intel.com>
  14. ---
  15. --- a/net/mac80211/status.c
  16. +++ b/net/mac80211/status.c
  17. @@ -558,6 +558,11 @@ static void ieee80211_report_used_skb(st
  18. }
  19. ieee80211_led_tx(local);
  20. +
  21. + if (skb_has_frag_list(skb)) {
  22. + kfree_skb_list(skb_shinfo(skb)->frag_list);
  23. + skb_shinfo(skb)->frag_list = NULL;
  24. + }
  25. }
  26. /*