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]
Date:	Mon, 17 Aug 2015 23:06:47 +0200
From:	Phil Sutter <phil@....cc>
To:	netdev@...r.kernel.org
Cc:	David Miller <davem@...emloft.net>, Thomas Graf <tgraf@...g.ch>
Subject: [PATCH] net: rtnetlink: be more strict when setting MAC address

Upon evaluation of IFLA_ADDRESS and IFLA_BROADCAST messages, make sure
the passed argument length matches dev->addr_len exactly.

This fixes dubious behaviour of 'ip link set eth0 addr <MAC>' where
'<MAC>' is too long, e.g. '00:11:22:33:44:55:66:77'. Called like this,
'ip' would return successfully and the kernel sets eth0's MAC address to
the leading six octets of the passed argument.

Signed-off-by: Phil Sutter <phil@....cc>
---
 net/core/rtnetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 788ceed..1d61cd1 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1456,11 +1456,11 @@ static int validate_linkmsg(struct net_device *dev, struct nlattr *tb[])
 {
 	if (dev) {
 		if (tb[IFLA_ADDRESS] &&
-		    nla_len(tb[IFLA_ADDRESS]) < dev->addr_len)
+		    nla_len(tb[IFLA_ADDRESS]) != dev->addr_len)
 			return -EINVAL;
 
 		if (tb[IFLA_BROADCAST] &&
-		    nla_len(tb[IFLA_BROADCAST]) < dev->addr_len)
+		    nla_len(tb[IFLA_BROADCAST]) != dev->addr_len)
 			return -EINVAL;
 	}
 
-- 
2.1.2

--
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