@@ -56,6 +56,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include <linux/trdevice.h>
#include <linux/stddef.h>
#include <linux/init.h>
@@ -1498,6 +1499,9 @@ static int xl_set_mac_address (struct net_device *dev, void *addr)
struct sockaddr *saddr = addr ;
struct xl_private *xl_priv = netdev_priv(dev);
+ if (!is_valid_ether_addr(saddr->sa_data))
+ return -EADDRNOTAVAIL;
+
if (netif_running(dev)) {
printk(KERN_WARNING "%s: Cannot set mac/laa address while card is open\n", dev->name) ;
return -EIO ;
@@ -113,6 +113,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include <linux/trdevice.h>
#include <linux/stddef.h>
#include <linux/init.h>
@@ -1488,6 +1489,9 @@ static int streamer_set_mac_address(struct net_device *dev, void *addr)
struct sockaddr *saddr = addr;
struct streamer_private *streamer_priv = netdev_priv(dev);
+ if (!is_valid_ether_addr(saddr->sa_data))
+ return -EADDRNOTAVAIL;
+
if (netif_running(dev))
{
printk(KERN_WARNING "%s: Cannot set mac/laa address while card is open\n", dev->name);
@@ -94,6 +94,7 @@
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
#include <linux/trdevice.h>
#include <linux/stddef.h>
#include <linux/init.h>
@@ -1351,6 +1352,9 @@ static int olympic_set_mac_address (struct net_device *dev, void *addr)
struct sockaddr *saddr = addr ;
struct olympic_private *olympic_priv = netdev_priv(dev);
+ if (!is_valid_ether_addr(saddr->sa_data))
+ return -EADDRNOTAVAIL;
+
if (netif_running(dev)) {
printk(KERN_WARNING "%s: Cannot set mac/laa address while card is open\n", dev->name) ;
return -EIO ;
@@ -2203,6 +2203,9 @@ static int tms380tr_set_mac_address(struct net_device *dev, void *addr)
{
struct net_local *tp = netdev_priv(dev);
struct sockaddr *saddr = addr;
+
+ if (!is_valid_ether_addr(saddr->sa_data))
+ return -EADDRNOTAVAIL;
if (tp->AdapterOpenFlag || tp->AdapterVirtOpenFlag) {
printk(KERN_WARNING "%s: Cannot set MAC/LAA address while card is open\n", dev->name);
Check if given address is valid in .ndo_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@bisect.de> --- drivers/net/tokenring/3c359.c | 4 ++++ drivers/net/tokenring/lanstreamer.c | 4 ++++ drivers/net/tokenring/olympic.c | 4 ++++ drivers/net/tokenring/tms380tr.c | 3 +++ 4 files changed, 15 insertions(+), 0 deletions(-)