From: Jiri Pirko Date: Tue, 1 Jan 2013 03:30:14 +0000 (+0000) Subject: net: call add_device_randomness() only after successful mac change X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f652151640344f8faee21fcf702b4fd46b8fe70b;p=linux-beck.git net: call add_device_randomness() only after successful mac change Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/net/core/dev.c b/net/core/dev.c index 21c5b976dcf3..c85e32b30f04 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5020,10 +5020,11 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) if (!netif_device_present(dev)) return -ENODEV; err = ops->ndo_set_mac_address(dev, sa); - if (!err) - call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); + if (err) + return err; + call_netdevice_notifiers(NETDEV_CHANGEADDR, dev); add_device_randomness(dev->dev_addr, dev->addr_len); - return err; + return 0; } EXPORT_SYMBOL(dev_set_mac_address);