aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-10-25 18:33:36 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-26 16:52:41 -0400
commit4a4f1a5808c8bb0b72a4f6e5904c53fb8c9cd966 (patch)
tree337243407a1d2240af23de94b042592311aaae63 /net
parent7dd111e8ee10cc6816669eabcad3334447673236 (diff)
mac80211: check management frame header length
Due to pskb_may_pull() checking the skb length, all non-management frames are checked on input whether their 802.11 header is fully present. Also add that check for management frames and remove a check that is now duplicate. This prevents accessing skb data beyond the frame end. Cc: stable@vger.kernel.org Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/rx.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index c6865f2f47f8..99cdee16e31b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1470,7 +1470,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx)
1470 frag = sc & IEEE80211_SCTL_FRAG; 1470 frag = sc & IEEE80211_SCTL_FRAG;
1471 1471
1472 if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || 1472 if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
1473 (rx->skb)->len < 24 ||
1474 is_multicast_ether_addr(hdr->addr1))) { 1473 is_multicast_ether_addr(hdr->addr1))) {
1475 /* not fragmented */ 1474 /* not fragmented */
1476 goto out; 1475 goto out;
@@ -2915,10 +2914,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
2915 if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) 2914 if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
2916 local->dot11ReceivedFragmentCount++; 2915 local->dot11ReceivedFragmentCount++;
2917 2916
2918 if (ieee80211_is_mgmt(fc)) 2917 if (ieee80211_is_mgmt(fc)) {
2919 err = skb_linearize(skb); 2918 /* drop frame if too short for header */
2920 else 2919 if (skb->len < ieee80211_hdrlen(fc))
2920 err = -ENOBUFS;
2921 else
2922 err = skb_linearize(skb);
2923 } else {
2921 err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); 2924 err = !pskb_may_pull(skb, ieee80211_hdrlen(fc));
2925 }
2922 2926
2923 if (err) { 2927 if (err) {
2924 dev_kfree_skb(skb); 2928 dev_kfree_skb(skb);