Commit 77b3055a authored by Andrew Morton's avatar Andrew Morton Committed by Patrick Mochel

[PATCH] fix bug in drivers/net/cs89x0.c:set_mac_address()

From: Bernardo Innocenti <bernie@develer.com>

the following patch fixes a bug in the CS89xx net device which would set
new MAC address through SIOCSIFHWADDR _only_ when net_debug is set, which
is obviously not what it was meant to do.  The original code bogusly
interpreted the addr argument as a buffer containing the MAC address
instead of a struct sockaddr.
parent 69aea20e
...@@ -1630,16 +1630,21 @@ static void set_multicast_list(struct net_device *dev) ...@@ -1630,16 +1630,21 @@ static void set_multicast_list(struct net_device *dev)
} }
static int set_mac_address(struct net_device *dev, void *addr) static int set_mac_address(struct net_device *dev, void *p)
{ {
int i; int i;
struct sockaddr *addr = p;
if (netif_running(dev)) if (netif_running(dev))
return -EBUSY; return -EBUSY;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
if (net_debug) { if (net_debug) {
printk("%s: Setting MAC address to ", dev->name); printk("%s: Setting MAC address to ", dev->name);
for (i = 0; i < 6; i++) for (i = 0; i < dev->addr_len; i++)
printk(" %2.2x", dev->dev_addr[i] = ((unsigned char *)addr)[i]); printk(" %2.2x", dev->dev_addr[i]);
printk(".\n"); printk(".\n");
} }
/* set the Ethernet address */ /* set the Ethernet address */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment