ath5k: fix race condition in tx desc processing
authorBob Copeland <me@bobcopeland.com>
Thu, 8 Apr 2010 03:55:58 +0000 (23:55 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 8 Apr 2010 19:24:16 +0000 (15:24 -0400)
commita05988bbbef5ac2391fe696646f0b80708f33f2e
tree6c3bce02d933f0de99776104450bd9d442befcf9
parent6b5d117eddc09cd976ad8030d715f4350f598a22
ath5k: fix race condition in tx desc processing

As pointed out by Benoit Papillault, there is a potential
race condition between the host and the hardware in reading
the next link in the transmit descriptor list:

cpu0              hw
                  tx for buf completed
                  raise tx_ok interrupt
process buf
buf->ds_link = 0
                  read buf->ds_link

This change checks txdp before processing a descriptor
(if there are any subsequent descriptors) to see if
hardware moved on.  We'll then process this descriptor on
the next tasklet.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
Acked-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/base.c