diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2010-03-27 13:05:27 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2010-03-27 13:05:27 +0000 |
commit | 55a949e0f72f5ac9730423e1bc0cf8d0f4a52561 (patch) | |
tree | b7af69e4c3b4d1c5c80fe5c26a9b64b934231cf6 /target/linux/ar71xx | |
parent | 9fb9eaa98ebd9900ad168c15873122d4621120a1 (diff) | |
download | master-187ad058-55a949e0f72f5ac9730423e1bc0cf8d0f4a52561.tar.gz master-187ad058-55a949e0f72f5ac9730423e1bc0cf8d0f4a52561.tar.bz2 master-187ad058-55a949e0f72f5ac9730423e1bc0cf8d0f4a52561.zip |
ar71xx: ag71xx: copy received packet to avoid unaligned access in the IP stack
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@20506 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r-- | target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c index f4c5a12147..989ed0e8a5 100644 --- a/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c +++ b/target/linux/ar71xx/files/drivers/net/ag71xx/ag71xx_main.c @@ -759,6 +759,23 @@ static int ag71xx_tx_packets(struct ag71xx *ag) return sent; } +static int ag71xx_rx_copy_skb(struct ag71xx *ag, struct sk_buff **pskb, + int pktlen) +{ + struct sk_buff *copy_skb; + + copy_skb = netdev_alloc_skb(ag->dev, pktlen + NET_IP_ALIGN); + if (!copy_skb) + return -ENOMEM; + + skb_reserve(copy_skb, NET_IP_ALIGN); + skb_copy_from_linear_data(*pskb, copy_skb->data, pktlen); + dev_kfree_skb_any(*pskb); + *pskb = copy_skb; + + return 0; +} + static int ag71xx_rx_packets(struct ag71xx *ag, int limit) { struct net_device *dev = ag->dev; @@ -798,6 +815,8 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) if (ag71xx_has_ar8216(ag)) err = ag71xx_remove_ar8216_header(ag, skb); + else + err = ag71xx_rx_copy_skb(ag, &skb, pktlen); if (err) { dev->stats.rx_dropped++; |