WANG Cong 0254e0c632 net: check dev->addr_len for dev_set_mac_address()
Historically, dev_ifsioc() uses struct sockaddr as mac
address definition, this is why dev_set_mac_address()
accepts a struct sockaddr pointer as input but now we
have various types of mac addresse whose lengths
are up to MAX_ADDR_LEN, longer than struct sockaddr,
and saved in dev->addr_len.

It is too late to fix dev_ifsioc() due to API
compatibility, so just reject those larger than
sizeof(struct sockaddr), otherwise we would read
and use some random bytes from kernel stack.

Fortunately, only a few IPv6 tunnel devices have addr_len
larger than sizeof(struct sockaddr) and they don't support
ndo_set_mac_addr(). But with team driver, in lb mode, they
can still be enslaved to a team master and make its mac addr
length as the same.

Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-07-29 11:25:05 -07:00
..
2017-07-12 14:39:43 -07:00
2017-06-05 11:24:28 -04:00
2017-03-12 23:47:16 -07:00
2017-07-13 09:18:46 -07:00
2017-04-03 19:04:48 -07:00
2017-04-25 13:33:49 -04:00
2015-04-02 14:04:59 -04:00
2015-11-22 11:54:10 -05:00
2017-04-13 13:58:20 -04:00
2015-10-26 22:24:22 -07:00