lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090106091050.GA19316@localhost>
Date:	Tue, 6 Jan 2009 17:10:50 +0800
From:	Wu Fengguang <wfg@...ux.intel.com>
To:	netdev@...r.kernel.org
Cc:	Peter Korsgaard <jacmet@...site.dk>
Subject: [PATCH] dm9601: warn on invalid mac address

Add warnings on invalid mac address to help disclose/debug problems.

Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
---
 drivers/net/usb/dm9601.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

--- linux-2.6.orig/drivers/net/usb/dm9601.c
+++ linux-2.6/drivers/net/usb/dm9601.c
@@ -401,8 +401,12 @@ static int dm9601_set_mac_address(struct
 	struct sockaddr *addr = p;
 	struct usbnet *dev = netdev_priv(net);
 
-	if (!is_valid_ether_addr(addr->sa_data))
+	if (!is_valid_ether_addr(addr->sa_data)) {
+		DECLARE_MAC_BUF(mac_buf);
+		print_mac(mac_buf, addr->sa_data);
+		dev_warn(&net->dev, "not setting invalid mac address %s\n", mac_buf);
 		return -EINVAL;
+	}
 
 	memcpy(net->dev_addr, addr->sa_data, net->addr_len);
 	dm_write_async(dev, DM_PHY_ADDR, net->addr_len, net->dev_addr);
@@ -449,6 +453,12 @@ static int dm9601_bind(struct usbnet *de
 	 */
 	if (is_valid_ether_addr(mac))
 		memcpy(dev->net->dev_addr, mac, ETH_ALEN);
+	else {
+		DECLARE_MAC_BUF(mac_buf);
+		print_mac(mac_buf, mac);
+		devdbg(dev, "EEPROM reported mac address %s is invalid,"
+				" use the randomly generated one.", mac_buf);
+	}
 
 	/* power up phy */
 	dm_write_reg(dev, DM_GPR_CTRL, 1);
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ