* [PATCH 2/4] forcedeth: xmit lock fix
@ 2009-01-09 21:03 Ayaz Abdulla
2009-01-10 7:13 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Ayaz Abdulla @ 2009-01-09 21:03 UTC (permalink / raw)
To: Manfred Spraul, Jeff Garzik, Andrew Morton, nedev
[-- Attachment #1: Type: text/plain, Size: 386 bytes --]
This patch fixes a potential race condition between xmit thread and xmit
completion thread. The calculation of empty tx descriptors is not
performed under the lock. This could cause it to set the stop flag while
the completion thread finishes all tx's. This will result in the tx
queue in stopped state and no one to wake it up.
Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
[-- Attachment #2: patch-forcedeth-xmitlockfix --]
[-- Type: text/plain, Size: 1123 bytes --]
--- old/drivers/net/forcedeth.c 2009-01-09 14:51:19.000000000 -0800
+++ new/drivers/net/forcedeth.c 2009-01-09 15:10:15.000000000 -0800
@@ -2096,14 +2096,15 @@
((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
}
+ spin_lock_irqsave(&np->lock, flags);
empty_slots = nv_get_empty_tx_slots(np);
if (unlikely(empty_slots <= entries)) {
- spin_lock_irqsave(&np->lock, flags);
netif_stop_queue(dev);
np->tx_stop = 1;
spin_unlock_irqrestore(&np->lock, flags);
return NETDEV_TX_BUSY;
}
+ spin_unlock_irqrestore(&np->lock, flags);
start_tx = put_tx = np->put_tx.orig;
@@ -2214,14 +2215,15 @@
((skb_shinfo(skb)->frags[i].size & (NV_TX2_TSO_MAX_SIZE-1)) ? 1 : 0);
}
+ spin_lock_irqsave(&np->lock, flags);
empty_slots = nv_get_empty_tx_slots(np);
if (unlikely(empty_slots <= entries)) {
- spin_lock_irqsave(&np->lock, flags);
netif_stop_queue(dev);
np->tx_stop = 1;
spin_unlock_irqrestore(&np->lock, flags);
return NETDEV_TX_BUSY;
}
+ spin_unlock_irqrestore(&np->lock, flags);
start_tx = put_tx = np->put_tx.ex;
start_tx_ctx = np->put_tx_ctx;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2/4] forcedeth: xmit lock fix
2009-01-09 21:03 [PATCH 2/4] forcedeth: xmit lock fix Ayaz Abdulla
@ 2009-01-10 7:13 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-01-10 7:13 UTC (permalink / raw)
To: aabdulla; +Cc: manfred, jgarzik, akpm, netdev
From: Ayaz Abdulla <aabdulla@nvidia.com>
Date: Fri, 09 Jan 2009 16:03:44 -0500
> This patch fixes a potential race condition between xmit thread and xmit completion thread. The calculation of empty tx descriptors is not performed under the lock. This could cause it to set the stop flag while the completion thread finishes all tx's. This will result in the tx queue in stopped state and no one to wake it up.
>
> Signed-off-by: Ayaz Abdulla <aabdulla@nvidia.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-01-10 7:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09 21:03 [PATCH 2/4] forcedeth: xmit lock fix Ayaz Abdulla
2009-01-10 7:13 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.