]> 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)
commitc2c1efff05f2b52e2a570d7967cb3b34ef5a3661
tree4b12c9f98f3f17a89be2f1467fb4a1200a3da90e
parent70023f12758c07e5eb41c020069feb1017464a22
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