Skip to contentSkip to conversation

2.5.55 fix etherleak in 8390.c [rescued]

PATCH In review Rudmer van Dijk 2 participants 2 messages Jan 10, 2003 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.55 fix etherleak in 8390.c [rescued]

this is the fix which went in 2.4.21-pre3-ac2, rediffed against 2.5.55

Rudmer

drivers/net/8390.c renamed from drivers/net/8390.c.orig +18 -2
@@ -270,6 +270,7 @@
 	struct ei_device *ei_local = (struct ei_device *) dev->priv;
 	int length, send_length, output_page;
 	unsigned long flags;
+	char scratch[ETH_ZLEN];
 
 	length = skb->len;
 
@@ -341,7 +342,15 @@
 	 * trigger the send later, upon receiving a Tx done interrupt.
 	 */
 
-	ei_block_output(dev, length, skb->data, output_page);
+	if (length == send_length)
+		ei_block_output(dev, length, skb->data, output_page);
+	else
+	{
+		memset(scratch, 0, ETH_ZLEN);
+		memcpy(scratch, skb->data, skb->len);
+		ei_block_output(dev, ETH_ZLEN, scratch, output_page);
+	}
+
 	if (! ei_local->txing) 
 	{
 		ei_local->txing = 1;
@@ -373,7 +382,14 @@
 	 * reasonable hardware if you only use one Tx buffer.
 	 */
 
-	ei_block_output(dev, length, skb->data, ei_local->tx_start_page);
+	if(length == send_length)
+		ei_block_output(dev, length, skb->data, ei_local->tx_start_page);
+	else
+	{
+		memset(scratch, 0, ETH_ZLEN);
+		memcpy(scratch, skb->data, skb->len);
+		ei_block_output(dev, ETH_ZLEN, scratch, ei_local->tx_start_page);
+	}
 	ei_local->txing = 1;
 	NS8390_trigger_send(dev, send_length, ei_local->tx_start_page);
 	dev->trans_start = jiffies;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 2 lines · Rudmer van Dijk

this is the fix which went in 2.4.21-pre3-ac2, rediffed against 2.5.55
Rudmer

That scratch[] allocation is 60 bytes, taken off the stack. It isn't very large, and isn't recursive, but still...

drivers/net/8390.c line 275

Quoted 9 lines
drivers/net/8390.c renamed from drivers/net/8390.c.orig +1 -0
@@ -270,6 +270,7 @@
 	struct ei_device *ei_local = (struct ei_device *) dev->priv;
 	int length, send_length, output_page;
 	unsigned long flags;
+	char scratch[ETH_ZLEN];
 
 	length = skb->len;

/Matti Aarnio