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
This commit is contained in:
mentor 2008-04-30 22:11:27 +00:00
parent bbcacb393a
commit 65868884d2

View File

@ -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;