From patchwork Wed Dec 5 22:29:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3.5.y.z, extended, stable] Patch "mac80211: check management frame header length" has been added to staging queue X-Patchwork-Submitter: Herton Ronaldo Krzesinski X-Patchwork-Id: 203993 Message-Id: <1354746599-21019-1-git-send-email-herton.krzesinski@canonical.com> To: Johannes Berg Cc: kernel-team@lists.ubuntu.com Date: Wed, 5 Dec 2012 20:29:59 -0200 From: Herton Ronaldo Krzesinski List-Id: Kernel team discussions This is a note to let you know that I have just added a patch titled mac80211: check management frame header length to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree which can be found at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue If you, or anyone else, feels it should not be added to this tree, please reply to this email. For more information about the 3.5.y.z tree, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable Thanks. -Herton ------ >From e57f5275ce3ecd4e6fc0e353fbcf8a429aff2611 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 26 Oct 2012 00:33:36 +0200 Subject: [PATCH] mac80211: check management frame header length X-Extended-Stable: 3.5 commit 4a4f1a5808c8bb0b72a4f6e5904c53fb8c9cd966 upstream. 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. Signed-off-by: Johannes Berg [ herton: unfuzz patch ] Signed-off-by: Herton Ronaldo Krzesinski --- net/mac80211/rx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -- 1.7.9.5 diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 4e4fc93..38800d3 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -1473,7 +1473,6 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) frag = sc & IEEE80211_SCTL_FRAG; if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || - (rx->skb)->len < 24 || is_multicast_ether_addr(hdr->addr1))) { /* not fragmented */ goto out; @@ -2923,10 +2922,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, test_bit(SCAN_SW_SCANNING, &local->scanning))) status->rx_flags |= IEEE80211_RX_IN_SCAN; - if (ieee80211_is_mgmt(fc)) - err = skb_linearize(skb); - else + if (ieee80211_is_mgmt(fc)) { + /* drop frame if too short for header */ + if (skb->len < ieee80211_hdrlen(fc)) + err = -ENOBUFS; + else + err = skb_linearize(skb); + } else { err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); + } if (err) { dev_kfree_skb(skb);