*************** static void rtl_init_mac_address(struct rtl8169_private *tp, *** 1943,1951 **** void __iomem *ioaddr) { struct pci_dev *pdev = tp->pci_dev; - u8 cfg1; int vpd_cap; u8 mac[8]; cfg1 = RTL_R8(Config1); if (!(cfg1 & VPD)) { --- 1947,1956 ---- void __iomem *ioaddr) { struct pci_dev *pdev = tp->pci_dev; int vpd_cap; + __le32 sig; u8 mac[8]; + u8 cfg1; cfg1 = RTL_R8(Config1); if (!(cfg1 & VPD)) { *************** static void rtl_init_mac_address(struct rtl8169_private *tp, *** 1960,1966 **** if (!vpd_cap) return; - /* MAC address is stored in EEPROM at offset 0x0e * Realtek says: "The VPD address does not have to be a DWORD-aligned * address as defined in the PCI 2.2 Specifications, but the VPD data * is always consecutive 4-byte data starting from the VPD address --- 1965,1980 ---- if (!vpd_cap) return; + if (rtl_eeprom_read(pdev, vpd_cap, RTL_EEPROM_SIG_ADDR, &sig) < 0) + return; + + if ((sig & RTL_EEPROM_SIG_MASK) != RTL_EEPROM_SIG) { + dev_info(&pdev->dev, "Missing EEPROM signature: %08x\n", sig); + return; + } + + /* + * MAC address is stored in EEPROM at offset 0x0e * Realtek says: "The VPD address does not have to be a DWORD-aligned * address as defined in the PCI 2.2 Specifications, but the VPD data * is always consecutive 4-byte data starting from the VPD address *************** static void rtl_init_mac_address(struct rtl8169_private *tp, *** 1982,1989 **** print_mac(buf, mac)); } - /* Write MAC address */ - rtl_rar_set(tp, mac); } static int __devinit --- 1996,2003 ---- print_mac(buf, mac)); } + if (is_valid_ether_addr(mac)) + rtl_rar_set(tp, mac); } static int __devinit