summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2007-11-22 23:03:42 +0100
committerJohn W. Linville <linville@tuxdriver.com>2007-11-30 00:08:47 +0100
commit01e1f045e65b683fe7203b1e16a915bbb94c15fe (patch)
tree480686e2f3c5c49bf56ae06ef98998335bdaa38a /net
parentmac80211: free ifsta->extra_ie and clear IEEE80211_STA_PRIVACY_INVOKED (diff)
downloadlinux-01e1f045e65b683fe7203b1e16a915bbb94c15fe.tar.xz
linux-01e1f045e65b683fe7203b1e16a915bbb94c15fe.zip
ieee80211: fix unaligned access in ieee80211_copy_snap
There is no guarantee that data+SNAP_SIZE will reside on an even numbered address, so doing a 16 bit read will cause an unaligned access in some situations. Based on a patch from Jun Sun. Signed-off-by: Daniel Drake <dsd@gentoo.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/ieee80211/ieee80211_tx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index a4c3c51140a3..6d06f1385e28 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -144,7 +144,8 @@ static int ieee80211_copy_snap(u8 * data, u16 h_proto)
snap->oui[1] = oui[1];
snap->oui[2] = oui[2];
- *(u16 *) (data + SNAP_SIZE) = htons(h_proto);
+ h_proto = htons(h_proto);
+ memcpy(data + SNAP_SIZE, &h_proto, sizeof(u16));
return SNAP_SIZE + sizeof(u16);
}