summaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2007-02-20 23:41:59 +0100
committerJeff Garzik <jeff@garzik.org>2007-02-27 10:16:03 +0100
commit5c8e98fe4742734c1c6b81699a86d1f5b03841e0 (patch)
tree6a93ccce6f545da153bc937548bc6fe1db1e99ab /drivers/net/spider_net.c
parentspidernet: fix racy double-free of skb (diff)
downloadlinux-5c8e98fe4742734c1c6b81699a86d1f5b03841e0.tar.xz
linux-5c8e98fe4742734c1c6b81699a86d1f5b03841e0.zip
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>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 15b0bcaec467..653a91adacc7 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;