On Thu, Dec 06, 2007 at 07:48:34PM +0100, Florian Lohoff wrote: > Reading only 0's from an eeprom in the driver can be detected. Why cant > the dmfe driver refuse to load (or better not claim the resources) in this > case? It used to be the case for hundrets of isa modules that they were > loaded, tried if their hardware was there and later if not just notified > that they failed to load. I know - these were the old days and we are > now pleased with an in kernel module loader and all that fancy stuff > but can't this be done ?!? It might mean to really rewrite a little of > module init logic and not really look at the chip at ifup time. My guess > is that nobody until now was annoyed enough to actually write the code :) Without having overly much kernel experience i had a look at dmfe.c and without testing i would guess this would at least prohibit dmfe to claim the resources when the mac is obviously '0'. The only problem this brings up is with cards where the mac address is 0 due to a production problem - Those would be basically unusable without a reverting patch. The MAC beeing 0 is obviously only a symptom and the difference might even be much more easy to detect. So using the MAC is most likely a crude hack. From my understanding for every driver registered all unclaimed devices will be probed. So with this dmfe will hopefully refuse to play with the device and return ENODEV which will let tulip when loaded claim the device. Somebody with more understanding of the DMFE will need to have a look here and make guesses on how to differentiate dmfes from tulips. diff --git a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c index b4891ca..c023ec0 100644 --- a/drivers/net/tulip/dmfe.c +++ b/drivers/net/tulip/dmfe.c @@ -362,6 +362,7 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, struct net_device *dev; u32 pci_pmr; int i, err; + u8 macor=0; DECLARE_MAC_BUF(mac); DMFE_DBUG(0, "dmfe_init_one()", 0); @@ -464,8 +465,15 @@ static int __devinit dmfe_init_one (struct pci_dev *pdev, cpu_to_le16(read_srom_word(db->ioaddr, i)); /* Set Node address */ - for (i = 0; i < 6; i++) + for (i = 0; i < 6; i++) { dev->dev_addr[i] = db->srom[20 + i]; + macor |= db->srom[20 + i]; + } + + if (!macor) { + err = -ENODEV; + goto err_out_res; + } err = register_netdev (dev); if (err) Flo -- Florian Lohoff flo@rfc822.org +49-171-2280134 Those who would give up a little freedom to get a little security shall soon have neither - Benjamin Franklin
Attachment:
signature.asc
Description: Digital signature