]> bbs.cooldavid.org Git - net-next-2.6.git/commit - drivers/net/tg3.c
tg3: Enforce DMA mapping / skb assignment ordering
authorMatt Carlson <mcarlson@broadcom.com>
Wed, 17 Feb 2010 15:16:54 +0000 (15:16 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Feb 2010 01:27:34 +0000 (17:27 -0800)
commit61e800cf949926b3d463ca3cf3025d964872774b
treeb855725b34c8b1f6b31b50052e2596a9797fcf96
parent99405162598176e830d17ae6d4f3d9e070ad900c
tg3: Enforce DMA mapping / skb assignment ordering

Michael Chan noted that there is nothing in the code that would prevent
the compiler from delaying the access of the "mapping" member of the
newly arrived packet until much later.  If this happened after the
skb = NULL assignment, it is possible for the driver to pass a bad
dma_addr value to pci_unmap_single().  To enforce this ordering, we need
a write memory barrier.  The pairing read memory barrier already exists
in tg3_rx_prodring_xfer() under the comments starting with
"Ensure that updates to the...".

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c