Skip to content

Commit

Permalink
mac80211: fix use-after-free
Browse files Browse the repository at this point in the history
commit 8c0c709
Author: Johannes Berg <johannes@sipsolutions.net>
Date:   Wed Nov 25 17:46:15 2009 +0100

    mac80211: move cmntr flag out of rx flags

moved the CMTR flag into the skb's status, and
in doing so introduced a use-after-free -- when
the skb has been handed to cooked monitors the
status setting will touch now invalid memory.

Additionally, moving it there has effectively
discarded the optimisation -- since the bit is
only ever set on freed SKBs, and those were a
copy, it could never be checked.

For the current release, fixing this properly
is a bit too involved, so let's just remove the
problematic code and leave userspace with one
copy of each frame for each virtual interface.

Cc: stable@kernel.org [2.6.33+]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Sep 24, 2010
1 parent df6d023 commit cd87a2d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions net/mac80211/rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2199,9 +2199,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
struct net_device *prev_dev = NULL;
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);

if (status->flag & RX_FLAG_INTERNAL_CMTR)
goto out_free_skb;

if (skb_headroom(skb) < sizeof(*rthdr) &&
pskb_expand_head(skb, sizeof(*rthdr), 0, GFP_ATOMIC))
goto out_free_skb;
Expand Down Expand Up @@ -2260,7 +2257,6 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx,
} else
goto out_free_skb;

status->flag |= RX_FLAG_INTERNAL_CMTR;
return;

out_free_skb:
Expand Down

0 comments on commit cd87a2d

Please sign in to comment.