From 46a98819d2f070bd365c75984acff7a7fd5ab334 Mon Sep 17 00:00:00 2001 From: Paolo Pisati Date: Mon, 20 Feb 2012 16:22:39 +0000 Subject: [PATCH] smsc95xx: panda: don't blindly overwrite MAC address During the registering of eth0 (NETDEV_REGISTER) don't blindly overwrite its MAC address (using die id supplied one) but check if the actual MAC was randomly created and, only in that case, overwrite it. Signed-off-by: Paolo Pisati --- arch/arm/mach-omap2/board-omap4panda.c | 4 ++++ drivers/net/usb/smsc95xx.c | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 035d56f..f1e8e6d 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -738,6 +738,10 @@ static int omap_panda_netdev_event(struct notifier_block *this, if (event != NETDEV_REGISTER) return NOTIFY_DONE; + if (strncmp(dev->name, "eth0", 4) == 0 && + !(dev->addr_assign_type & NET_ADDR_RANDOM)) + return NOTIFY_DONE; + n = panda_device_path_need_mac(dev->dev.parent); if (n >= 0) { sa.sa_family = dev->type; diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 89b51bd..ea95dd1 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -669,7 +669,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) } /* no eeprom, or eeprom values are invalid. generate random MAC */ - random_ether_addr(dev->net->dev_addr); + dev_hw_addr_random(dev->net, dev->net->dev_addr); netif_dbg(dev, ifup, dev->net, "MAC address set to random_ether_addr\n"); } -- 1.7.9