spidernet: transmit race

Multiple threads performing a transmit can race into
the spidernet tx ring cleanup code. This puts the
relevant check under a lock.

Signed-off-by: Linas Vepstas <lins@austin.ibm.com>
Cc: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Cc: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Linas Vepstas 2007-02-20 16:41:59 -06:00 committed by Jeff Garzik
parent d9c199ee78
commit 5c8e98fe47

View File

@ -803,8 +803,12 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal)
unsigned long flags;
int status;
while (chain->tail != chain->head) {
while (1) {
spin_lock_irqsave(&chain->lock, flags);
if (chain->tail == chain->head) {
spin_unlock_irqrestore(&chain->lock, flags);
return 0;
}
descr = chain->tail;
hwdescr = descr->hwdescr;