Commit 02ff05c4 authored by David Brownell's avatar David Brownell Committed by David S. Miller

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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Acked-by: default avatarClaudio Lanconelli <lanconelli.claudio@eptar.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e8a1d919
...@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) ...@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) if (RSV_GETBIT(rxstat, RSV_LENCHECKERR))
ndev->stats.rx_frame_errors++; ndev->stats.rx_frame_errors++;
} else { } else {
skb = dev_alloc_skb(len); skb = dev_alloc_skb(len + NET_IP_ALIGN);
if (!skb) { if (!skb) {
if (netif_msg_rx_err(priv)) if (netif_msg_rx_err(priv))
dev_err(&ndev->dev, dev_err(&ndev->dev,
...@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev) ...@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
ndev->stats.rx_dropped++; ndev->stats.rx_dropped++;
} else { } else {
skb->dev = ndev; skb->dev = ndev;
skb_reserve(skb, NET_IP_ALIGN);
/* copy the packet from the receive buffer */ /* copy the packet from the receive buffer */
enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv), enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv),
len, skb_put(skb, len)); len, skb_put(skb, len));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment