[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1330099282-4588-10-git-send-email-danny.kukawka@bisect.de>
Date: Fri, 24 Feb 2012 17:01:19 +0100
From: Danny Kukawka <danny.kukawka@...ect.de>
To: "David S. Miller" <davem@...emloft.net>
Cc: Danny Kukawka <dkukawka@...e.de>,
Stephen Hemminger <shemminger@...tta.com>,
Jiri Pirko <jpirko@...hat.com>, Joe Perches <joe@...ches.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 09/12] wan/lapbether: check given MAC address, if invalid return -EADDRNOTAVAIL
Check if given address is valid in .ndo_set_mac_address/
lapbeth_set_mac_address(), if invalid return -EADDRNOTAVAIL as
eth_mac_addr() already does if is_valid_ether_addr() fails.
Signed-off-by: Danny Kukawka <danny.kukawka@...ect.de>
---
drivers/net/wan/lapbether.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 7beeb9b..b6d4cbc 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -45,6 +45,7 @@
#include <linux/module.h>
#include <linux/lapb.h>
#include <linux/init.h>
+#include <linux/etherdevice.h>
#include <net/x25device.h>
@@ -254,6 +255,10 @@ static void lapbeth_disconnected(struct net_device *dev, int reason)
static int lapbeth_set_mac_address(struct net_device *dev, void *addr)
{
struct sockaddr *sa = addr;
+
+ if (!is_valid_ether_addr(sa->sa_data))
+ return -EADDRNOTAVAIL;
+
memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);
return 0;
}
--
1.7.8.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists