Skip to contentSkip to conversation

PATCH: 3c59x 00:00:00:00:00:00 MAC failure

PATCH Alan Cox 4 participants 5 messages Sep 29, 2004 Networking

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

The 3com EEPROM has a checksum but unfortunately it seems that a zapped EEPROM returning all zero values passes the checksum test fine and we try and use it.

net/3c59x.c renamed from net/3c59x.c~ +7 -0
@@ -1295,6 +1295,13 @@
 		for (i = 0; i < 6; i++)
 			printk("%c%2.2x", i ? ':' : ' ', dev->dev_addr[i]);
 	}
+	/* Unfortunately an all zero eeprom passes the checksum and this
+	   gets found in the wild in failure cases. Crypto is hard 8) */
+	if (memcmp(dev->dev_addr, "\0\0\0\0\0", 6) == 0) {
+		retval = -EINVAL;
+		printk(KERN_ERR "*** EEPROM MAC address is invalid.\n");
+		goto free_ring;	/* With every pack */
+	}
 	EL3WINDOW(2);
 	for (i = 0; i < 6; i++)
 		outb(dev->dev_addr[i], ioaddr + i);
#1 lore raw
Quoted 8 lines · Alan Cox

The 3com EEPROM has a checksum but unfortunately it seems that a zapped EEPROM returning all zero values passes the checksum test fine and we try and use it.

net/3c59x.c line 1300

Quoted 6 lines
net/3c59x.c renamed from net/3c59x.c~ +3 -0
@@ -1295,6 +1295,13 @@
 		for (i = 0; i < 6; i++)
 			printk("%c%2.2x", i ? ':' : ' ', dev->dev_addr[i]);
 	}
+	/* Unfortunately an all zero eeprom passes the checksum and this
+	   gets found in the wild in failure cases. Crypto is hard 8) */
+	if (memcmp(dev->dev_addr, "\0\0\0\0\0", 6) == 0) {

Shouldn't this be using is_valid_ether_addr() ?

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
#2 lore raw
Quoted 7 lines · Russell King
Quoted 5 lines · Alan Cox

The 3com EEPROM has a checksum but unfortunately it seems that a zapped EEPROM returning all zero values passes the checksum test fine and we try and use it.

Quoted 12 lines

net/3c59x.c line 1300

Quoted 9 lines
net/3c59x.c renamed from net/3c59x.c~ +3 -0
@@ -1295,6 +1295,13 @@
 		for (i = 0; i < 6; i++)
 			printk("%c%2.2x", i ? ':' : ' ', dev->dev_addr[i]);
 	}
+	/* Unfortunately an all zero eeprom passes the checksum and this
+	   gets found in the wild in failure cases. Crypto is hard 8) */
+	if (memcmp(dev->dev_addr, "\0\0\0\0\0", 6) == 0) {

Shouldn't this be using is_valid_ether_addr() ?

Yes.

Jeff

#3 lore raw
Quoted 3 lines · Jeff Garzik
Quoted 1 line

Shouldn't this be using is_valid_ether_addr() ?

Yes.

Fixed in my tree - want another diff ?

#4 lore raw
Quoted 8 lines · Alan Cox
Quoted 3 lines · Jeff Garzik
Quoted 1 line

Shouldn't this be using is_valid_ether_addr() ?

Yes.

Fixed in my tree - want another diff ?

pretty please :)

Jeff