Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rndis_host: Set valid random MAC on buggy devices

Some devices of the same type all export the same, random MAC address. This
behavior has been seen on the ZTE MF910, MF823 and MF831, and there are
probably more devices out there. Fix this by generating a valid random MAC
address if we read a random MAC from device.

Also, changed the memcpy() to ether_addr_copy(), as pointed out by
checkpatch.

Suggested-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Kristian Evensen <kristian.evensen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Kristian Evensen and committed by
David S. Miller
a5a18bdf 43de8746

+5 -1
+5 -1
drivers/net/usb/rndis_host.c
··· 428 428 dev_err(&intf->dev, "rndis get ethaddr, %d\n", retval); 429 429 goto halt_fail_and_release; 430 430 } 431 - memcpy(net->dev_addr, bp, ETH_ALEN); 431 + 432 + if (bp[0] & 0x02) 433 + eth_hw_addr_random(net); 434 + else 435 + ether_addr_copy(net->dev_addr, bp); 432 436 433 437 /* set a nonzero filter to enable data transfers */ 434 438 memset(u.set, 0, sizeof *u.set);