aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-12-18 09:11:35 -0500
committerDavid S. Miller <davem@davemloft.net>2007-12-26 22:36:32 -0500
commit81100eb80add328c4d2a377326f15aa0e7236398 (patch)
tree03b8f14120b8c2aece64bc7f13d52cb4a190b091 /net/mac80211
parent0d17440688ad83de46e94e9fa11edb5a7fb3d180 (diff)
mac80211: warn when receiving frames with unaligned data
This patch makes mac80211 warn (once) when the driver passes up a frame in which the payload data is not aligned on a four-byte boundary, with a long comment for people who run into the condition and need to know what to do. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/rx.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 00f908d9275e..a7263fc476bd 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -1443,6 +1443,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1443 struct ieee80211_sub_if_data *prev = NULL; 1443 struct ieee80211_sub_if_data *prev = NULL;
1444 struct sk_buff *skb_new; 1444 struct sk_buff *skb_new;
1445 u8 *bssid; 1445 u8 *bssid;
1446 int hdrlen;
1446 1447
1447 /* 1448 /*
1448 * key references and virtual interfaces are protected using RCU 1449 * key references and virtual interfaces are protected using RCU
@@ -1472,6 +1473,18 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1472 rx.fc = le16_to_cpu(hdr->frame_control); 1473 rx.fc = le16_to_cpu(hdr->frame_control);
1473 type = rx.fc & IEEE80211_FCTL_FTYPE; 1474 type = rx.fc & IEEE80211_FCTL_FTYPE;
1474 1475
1476 /*
1477 * Drivers are required to align the payload data to a four-byte
1478 * boundary, so the last two bits of the address where it starts
1479 * may not be set. The header is required to be directly before
1480 * the payload data, padding like atheros hardware adds which is
1481 * inbetween the 802.11 header and the payload is not supported,
1482 * the driver is required to move the 802.11 header further back
1483 * in that case.
1484 */
1485 hdrlen = ieee80211_get_hdrlen(rx.fc);
1486 WARN_ON_ONCE(((unsigned long)(skb->data + hdrlen)) & 3);
1487
1475 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT) 1488 if (type == IEEE80211_FTYPE_DATA || type == IEEE80211_FTYPE_MGMT)
1476 local->dot11ReceivedFragmentCount++; 1489 local->dot11ReceivedFragmentCount++;
1477 1490