Skip to content
Commit f45a4248 authored by Anant Thazhemadam's avatar Anant Thazhemadam Committed by David S. Miller
Browse files

net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails



When get_registers() fails in set_ethernet_addr(),the uninitialized
value of node_id gets copied over as the address.
So, check the return value of get_registers().

If get_registers() executed successfully (i.e., it returns
sizeof(node_id)), copy over the MAC address using ether_addr_copy()
(instead of using memcpy()).

Else, if get_registers() failed instead, a randomly generated MAC
address is set as the MAC address instead.

Reported-by: default avatar <syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com>
Tested-by: default avatar <syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com>
Acked-by: default avatarPetko Manolov <petkan@nucleusys.com>
Signed-off-by: default avatarAnant Thazhemadam <anant.thazhemadam@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 017512a0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment