summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>2012-08-10 07:56:21 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-09-27 12:21:36 -0500
commit460f949f897a401b40327be7a1a9cccd22762c77 (patch)
treec08998decc34ad49a816da45458afc4be237b120 /net
parent185f7d9afc9b5c77bbedc386a43019e07e5d0c04 (diff)
downloadu-boot-460f949f897a401b40327be7a1a9cccd22762c77.tar.gz
net: eth_write_hwaddr: Return error for invalid MACs
If dev->enetaddr was supposed to be set with dev->write_hwaddr() but the MAC address was not valid, return an error. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'net')
-rw-r--r--net/eth.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/eth.c b/net/eth.c
index 49458c8db9..321d5b18fd 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -218,9 +218,12 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
}
if (dev->write_hwaddr &&
- !eth_mac_skip(eth_number) &&
- is_valid_ether_addr(dev->enetaddr))
+ !eth_mac_skip(eth_number)) {
+ if (!is_valid_ether_addr(dev->enetaddr))
+ return -1;
+
ret = dev->write_hwaddr(dev);
+ }
return ret;
}