linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: linas@austin.ibm.com (Linas Vepstas)
To: jgarzik@pobox.com
Cc: linuxppc-dev@ozlabs.org, James K Lewis <jklewis@us.ibm.com>,
	Jens Osterkamp <Jens.Osterkamp@de.ibm.com>,
	netdev@vger.kernel.org
Subject: [PATCH 4/5]: spidernet: transmit race
Date: Fri, 9 Feb 2007 18:22:05 -0600	[thread overview]
Message-ID: <20070210002205.GD2396@austin.ibm.com> (raw)
In-Reply-To: <20070210000128.GJ5616@austin.ibm.com>



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: James K Lewis <jklewis@us.ibm.com>
Cc: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Cc: Kou Ishizaki <kou.ishizaki@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-09 17:30:13.000000000 -0600
+++ linux-2.6.20-git4/drivers/net/spider_net.c	2007-02-09 17:37:41.000000000 -0600
@@ -767,8 +767,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;
 

  parent reply	other threads:[~2007-02-10  0:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-10  0:01 [PATCH 0/5]: spidernet: misc fixes Linas Vepstas
2007-02-10  0:14 ` [PATCH 1/5]: spidernet: compile break Linas Vepstas
2007-02-10  0:16 ` [PATCH 2/5] spidernet: separate hardware state from driver state Linas Vepstas
2007-02-10  0:19 ` [PATCH: 3/5]: spidernet: fix racy double-free of skb Linas Vepstas
2007-02-10  0:22 ` Linas Vepstas [this message]
2007-02-10  0:23 ` [PATCH 0/5]: spidernet: misc fixes Linas Vepstas
2007-02-10  0:25   ` [PATCH 5/5]: spidernet janitorial: typos Linas Vepstas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070210002205.GD2396@austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=Jens.Osterkamp@de.ibm.com \
    --cc=jgarzik@pobox.com \
    --cc=jklewis@us.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).