diff options
author | Thomas Chou <thomas@wytron.com.tw> | 2009-10-05 03:33:19 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-07 14:50:12 +0400 |
commit | 050f91dcd9a45a14449dded5180f633692b588d2 (patch) | |
tree | 93b1b4c4bcd43b70a08e68fd1b9ae313a5fd559e /drivers/net/ethoc.c | |
parent | 3ee19a85bb428b8363699dff9e1c4041c107d46a (diff) | |
download | linux-050f91dcd9a45a14449dded5180f633692b588d2.tar.xz |
ethoc: align received packet to make IP header at word boundary
The packet buffer is allocated at 4 bytes boundary, but the IP header
length and version bits is located at byte 14. These bit fields access
as 32 bits word and caused exception on processors that do not support
unaligned access.
The patch adds 2 bytes offset to make the bit fields word aligned.
Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethoc.c')
-rw-r--r-- | drivers/net/ethoc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index f92747fc5f8b..0c6c7f47ace4 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -399,6 +399,10 @@ static int ethoc_rx(struct net_device *dev, int limit) if (ethoc_update_rx_stats(priv, &bd) == 0) { int size = bd.stat >> 16; struct sk_buff *skb = netdev_alloc_skb(dev, size); + + size -= 4; /* strip the CRC */ + skb_reserve(skb, 2); /* align TCP/IP header */ + if (likely(skb)) { void *src = phys_to_virt(bd.addr); memcpy_fromio(skb_put(skb, size), src, size); |