net: systemport: fix dma_unmap_single() len
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 15 May 2014 21:33:52 +0000 (14:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 May 2014 20:41:40 +0000 (16:41 -0400)
dma_unmap_single() was called with dma_unmap_len(cb, dma_len),
unfortunately we failed to assign this length field in
bcm_sysport_rx_refill() or bcm_sysport_alloc_rx_bufs() using
dma_unmap_len_set().

This causes packet contents corruption because are we not invoking the
cache invalidation routines with the proper length.  Fix this by using
the full RX buffer size (RX_BUF_LENGTH) because the mappings for the RX
bufers are created with that size.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bcmsysport.c

index 8edc0980cdf56634d2dc96d8af6e780720145694..26030d67518b3ec4d55659052a52d87186e02e75 100644 (file)
@@ -479,7 +479,7 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
                cb = &priv->rx_cbs[priv->rx_read_ptr];
                skb = cb->skb;
                dma_unmap_single(kdev, dma_unmap_addr(cb, dma_addr),
-                               dma_unmap_len(cb, dma_len), DMA_FROM_DEVICE);
+                               RX_BUF_LENGTH, DMA_FROM_DEVICE);
 
                /* Extract the Receive Status Block prepended */
                rsb = (struct rsb *)skb->data;