From 460f949f897a401b40327be7a1a9cccd22762c77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Date: Fri, 10 Aug 2012 07:56:21 +0000 Subject: [PATCH] net: eth_write_hwaddr: Return error for invalid MACs MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Cc: Joe Hershberger Acked-by: Mike Frysinger --- net/eth.c | 7 +++++-- 1 file 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; } -- 2.30.2