]> err.no Git - linux-2.6/commitdiff
net/enc28j60: oops fix
authorDavid Brownell <dbrownell@users.sourceforge.net>
Thu, 6 Mar 2008 02:51:19 +0000 (18:51 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Mar 2008 02:51:19 +0000 (18:51 -0800)
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 <dbrownell@users.sourceforge.net>
Acked-by: Claudio Lanconelli <lanconelli.claudio@eptar.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/enc28j60.c

index 0809a6a5a286ec8325a562a4acc510a2b60ae765..46a90e9ec56320e4eaca6d48ba21c6d463981ddc 100644 (file)
@@ -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));