From: mentor Date: Wed, 30 Apr 2008 22:11:27 +0000 (+0000) Subject: Do not modify source packet in ieee80211_input_monitor if the headroom is not suffici... X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=65868884d27a587120c55bcc35f24cd3f4e6dd51;p=madwifi%2F.git Do not modify source packet in ieee80211_input_monitor if the headroom is not sufficient. Instead, make sure the copied skb is allocated with enough headroom. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3586 0192ed92-7a03-0410-a25b-9323aeb14dbd --- diff --git a/net80211/ieee80211_monitor.c b/net80211/ieee80211_monitor.c index 54b5e6c..07a1202 100644 --- a/net80211/ieee80211_monitor.c +++ b/net80211/ieee80211_monitor.c @@ -297,6 +297,11 @@ EXPORT_SYMBOL(ieee80211_monitor_encap); /* * Context: softIRQ (tasklet) */ +#define MON_PKT_HDRSPACE ((unsigned int) \ + A_MAX(sizeof(struct ath_tx_radiotap_header), \ + A_MAX(sizeof(struct wlan_ng_prism2_header), \ + ATHDESC_HEADER_SIZE))) + void ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb, const struct ath_buf *bf, int tx, u_int64_t mactime, struct ath_softc *sc) @@ -306,17 +311,6 @@ ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb, int noise = 0, antenna = 0, ieeerate = 0; u_int32_t rssi = 0; u_int8_t pkttype = 0; - unsigned int mon_hdrspace = A_MAX(sizeof(struct ath_tx_radiotap_header), - (A_MAX(sizeof(struct wlan_ng_prism2_header), - ATHDESC_HEADER_SIZE))); - - if ((skb_headroom(skb) < mon_hdrspace) && - pskb_expand_head(skb, mon_hdrspace, 0, GFP_ATOMIC)) { - printk("No headroom for monitor header - %s:%d %s\n", - __FILE__, __LINE__, __func__); - return; - } - if (tx) { rssi = bf->bf_dsstatus.ds_txstat.ts_rssi; antenna = bf->bf_dsstatus.ds_txstat.ts_antenna; @@ -382,7 +376,12 @@ ieee80211_input_monitor(struct ieee80211com *ic, struct sk_buff *skb, /* don't rx fromds, tods, or dstods packets */ continue; } - skb1 = skb_copy(skb, GFP_ATOMIC); + + if (skb_headroom(skb) < MON_PKT_HDRSPACE) + skb1 = skb_copy_expand(skb, MON_PKT_HDRSPACE, + 0, GFP_ATOMIC); + else + skb1 = skb_copy(skb, GFP_ATOMIC); if (skb1 == NULL) { /* XXX stat+msg */ continue;