[PATCH 10/12] spidernet: transmit race

Linas Vepstas linas at austin.ibm.com
Fri Feb 16 11:55:43 EST 2007


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 at austin.ibm.com>
Cc: Jens Osterkamp <Jens.Osterkamp at de.ibm.com>
Cc: Kou Ishizaki <kou.ishizaki at toshiba.co.jp>

----
 drivers/net/spider_net.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Index: linux-2.6.20-git4/drivers/net/spider_net.c
===================================================================
--- linux-2.6.20-git4.orig/drivers/net/spider_net.c	2007-02-15 17:58:54.000000000 -0600
+++ linux-2.6.20-git4/drivers/net/spider_net.c	2007-02-15 18:00:49.000000000 -0600
@@ -803,8 +803,12 @@ spider_net_release_tx_chain(struct spide
 	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;
 



More information about the Linuxppc-dev mailing list