lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080317191722.GB17828@xi.wantstofly.org>
Date:	Mon, 17 Mar 2008 20:17:22 +0100
From:	Lennert Buytenhek <buytenh@...tstofly.org>
To:	netdev@...r.kernel.org
Cc:	Dale Farnsworth <dale@...nsworth.org>,
	Nicolas Pitre <nico@...vell.com>,
	Tzachi Perelstein <tzachi@...vell.com>,
	Saeed Bishara <saeed@...vell.com>
Subject: [PATCH 1/7][MV643XX_ETH] mp->tx_desc_count needs spinlock protection

mv643xx_eth_start_xmit() should check mp->tx_desc_count only
inside the mp->lock spinlock.

Signed-off-by: Lennert Buytenhek <buytenh@...vell.com>
Acked-by: Tzachi Perelstein <tzachi@...vell.com>

Index: linux-2.6.25-rc6/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6.25-rc6.orig/drivers/net/mv643xx_eth.c
+++ linux-2.6.25-rc6/drivers/net/mv643xx_eth.c
@@ -1741,23 +1741,22 @@ static int mv643xx_eth_start_xmit(struct
 	BUG_ON(netif_queue_stopped(dev));
 	BUG_ON(skb == NULL);
 
+	if (has_tiny_unaligned_frags(skb) && __skb_linearize(skb)) {
+		stats->tx_dropped++;
+		printk(KERN_DEBUG "%s: failed to linearize tiny "
+				"unaligned fragment\n", dev->name);
+		return 1;
+	}
+
+	spin_lock_irqsave(&mp->lock, flags);
+
 	if (mp->tx_ring_size - mp->tx_desc_count < MAX_DESCS_PER_SKB) {
 		printk(KERN_ERR "%s: transmit with queue full\n", dev->name);
 		netif_stop_queue(dev);
+		spin_unlock_irqrestore(&mp->lock, flags);
 		return 1;
 	}
 
-	if (has_tiny_unaligned_frags(skb)) {
-		if (__skb_linearize(skb)) {
-			stats->tx_dropped++;
-			printk(KERN_DEBUG "%s: failed to linearize tiny "
-					"unaligned fragment\n", dev->name);
-			return 1;
-		}
-	}
-
-	spin_lock_irqsave(&mp->lock, flags);
-
 	eth_tx_submit_descs_for_skb(mp, skb);
 	stats->tx_bytes += skb->len;
 	stats->tx_packets++;
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ