diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-01-01 03:30:14 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-03 22:37:35 -0800 |
commit | f652151640344f8faee21fcf702b4fd46b8fe70b (patch) | |
tree | e14102323aec4459eee4f5f55a433675e575a396 /net/core/dev.c | |
parent | e7c3273ec2a04bbce27e0991c405fe6dc6811d7d (diff) | |
download | lwn-f652151640344f8faee21fcf702b4fd46b8fe70b.tar.gz lwn-f652151640344f8faee21fcf702b4fd46b8fe70b.zip |
net: call add_device_randomness() only after successful mac change
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 7 |
1 files changed, 4 insertions, 3 deletions
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); |