diff mbox

Phonet: fix accounting race between gprs_writeable() and gprs_xmit()

Message ID 1243852516-16597-1-git-send-email-remi.denis-courmont@nokia.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Rémi Denis-Courmont June 1, 2009, 10:35 a.m. UTC
From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

In the unlikely event that gprs_writeable() and gprs_xmit() check for
writeability at the same, we could stop the device queue forever.

Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
---
 net/phonet/pep-gprs.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Comments

David Miller June 2, 2009, 7:17 a.m. UTC | #1
From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
Date: Mon,  1 Jun 2009 13:35:16 +0300

> From: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>
> 
> In the unlikely event that gprs_writeable() and gprs_xmit() check for
> writeability at the same, we could stop the device queue forever.
> 
> Signed-off-by: Rémi Denis-Courmont <remi.denis-courmont@nokia.com>

Applied to net-next-2.6
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/phonet/pep-gprs.c b/net/phonet/pep-gprs.c
index 4aa8885..851f6a3 100644
--- a/net/phonet/pep-gprs.c
+++ b/net/phonet/pep-gprs.c
@@ -212,8 +212,9 @@  static int gprs_xmit(struct sk_buff *skb, struct net_device *dev)
 		dev->stats.tx_bytes += len;
 	}
 
-	if (!pep_writeable(sk))
-		netif_stop_queue(dev);
+	netif_stop_queue(dev);
+	if (pep_writeable(sk))
+		netif_wake_queue(dev);
 	return 0;
 }