From: Linas Vepstas Date: Tue, 20 Feb 2007 22:41:59 +0000 (-0600) Subject: spidernet: transmit race X-Git-Tag: v2.6.21-rc2~3^2~38 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5c8e98fe4742734c1c6b81699a86d1f5b03841e0;p=linux-2.6 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 Cc: Jens Osterkamp Cc: Kou Ishizaki Signed-off-by: Jeff Garzik --- diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 15b0bcaec4..653a91adac 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c @@ -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;