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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100121114244.GC32259@kryten>
Date:	Thu, 21 Jan 2010 22:42:44 +1100
From:	Anton Blanchard <anton@...ba.org>
To:	Jeff Kirsher <jeffrey.t.kirsher@...el.com>,
	Jesse Brandeburg <jesse.brandeburg@...el.com>,
	Bruce Allan <bruce.w.allan@...el.com>,
	PJ Waskiewicz <peter.p.waskiewicz.jr@...el.com>,
	John Ronciak <john.ronciak@...el.com>,
	Don Skidmore <donald.c.skidmore@...el.com>,
	Yi Zou <yi.zou@...el.com>,
	Alexander Duyck <alexander.h.duyck@...el.com>
Cc:	e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org
Subject: [PATCH 1/2] e1000: Fix DMA mapping error handling on TX


There were a few issues in the DMA mapping error handling in e1000_tx_map
which I found via fault injection.

If we fail to map the first descriptor count will end up as -1 but the
check of (count >= 0) will still be true since count is unsigned. Instead
of changing count to be signed, just simplify the logic.

Secondly, when we wrap the tx ring we rely on i to go negative, but it
was unsigned.

Signed-off-by: Anton Blanchard <anton@...ba.org>
---

Index: linux.trees.git/drivers/net/e1000/e1000_main.c
===================================================================
--- linux.trees.git.orig/drivers/net/e1000/e1000_main.c	2010-01-21 11:10:00.000000000 +1100
+++ linux.trees.git/drivers/net/e1000/e1000_main.c	2010-01-21 11:12:52.000000000 +1100
@@ -2693,8 +2693,9 @@ static int e1000_tx_map(struct e1000_ada
 	struct pci_dev *pdev = adapter->pdev;
 	struct e1000_buffer *buffer_info;
 	unsigned int len = skb_headlen(skb);
-	unsigned int offset = 0, size, count = 0, i;
+	unsigned int offset = 0, size, count = 0;
 	unsigned int f;
+	int i;
 
 	i = tx_ring->next_to_use;
 
@@ -2802,10 +2803,8 @@ static int e1000_tx_map(struct e1000_ada
 dma_error:
 	dev_err(&pdev->dev, "TX DMA map failed\n");
 	buffer_info->dma = 0;
-	count--;
 
-	while (count >= 0) {
-		count--;
+	while (count--) {
 		i--;
 		if (i < 0)
 			i += tx_ring->count;
--
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