From: David Brownell Date: Thu, 6 Mar 2008 02:51:19 +0000 (-0800) Subject: net/enc28j60: oops fix X-Git-Tag: v2.6.25-rc6~31^2~19 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02ff05c49d7804f2574f358a937b43a41d15e36e;p=linux-2.6 net/enc28j60: oops fix Prevent oops on enc28j60 packet RX: make sure buffers are aligned. Not all architectures support unaligned accesses in kernel space. Signed-off-by: David Brownell Acked-by: Claudio Lanconelli Signed-off-by: David S. Miller --- diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 0809a6a5a2..46a90e9ec5 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) ndev->stats.rx_frame_errors++; } else { - skb = dev_alloc_skb(len); + skb = dev_alloc_skb(len + NET_IP_ALIGN); if (!skb) { if (netif_msg_rx_err(priv)) dev_err(&ndev->dev, @@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) ndev->stats.rx_dropped++; } else { skb->dev = ndev; + skb_reserve(skb, NET_IP_ALIGN); /* copy the packet from the receive buffer */ enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), len, skb_put(skb, len));