]> git.baikalelectronics.ru Git - kernel.git/commit
net: fec: make rx skb handling more robust
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 7 Jul 2014 23:23:14 +0000 (00:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 8 Jul 2014 04:21:22 +0000 (21:21 -0700)
commit879a7b429d8f022718ea80bdc6e5afbf04e023b3
tree4b12c9f98f3f17a89be2f1467fb4a1200a3da90e
parent89f5f1b8bf0c4b653020dbb29616de0ea5e676f8
net: fec: make rx skb handling more robust

Allocate, and then map the receive skb before writing any data to the
ring descriptor or storing the skb.  When freeing the receive ring
entries, unmap and free the skb, and then clear the stored skb pointer.

This means we have ring data and skb pointer in one of two states:
either both fully setup, or nothing setup.

This simplifies the cleanup, as we can use just the skb pointer to
indicate whether the descriptor is setup, and thus avoids potentially
calling dma_unmap_single() on a DMA error value.

Acked-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c