]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: u_ether: fix regression in setting fixed MAC address
authorMarian Postevca <posteuca@mutex.one>
Fri, 3 Jun 2022 15:34:59 +0000 (18:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 10:44:35 +0000 (12:44 +0200)
commit824c765b5c4e672f2fb23dc46a1a17cd7c5e0462
treecf4c866f98711e5653b4c0c1ebc2ab5d1a7ed976
parent2145a268f5d5347dfdbc8dcdb69f8965239ad392
usb: gadget: u_ether: fix regression in setting fixed MAC address

commit 8f04ea50853bfe25039d5a38dd234eb26e957d40 upstream.

In systemd systems setting a fixed MAC address through
the "dev_addr" module argument fails systematically.
When checking the MAC address after the interface is created
it always has the same but different MAC address to the one
supplied as argument.

This is partially caused by systemd which by default will
set an internally generated permanent MAC address for interfaces
that are marked as having a randomly generated address.

Commit 38008d64ea50659b ("usb: gadget: u_ether: fix race in
setting MAC address in setup phase") didn't take into account
the fact that the interface must be marked as having a set
MAC address when it's set as module argument.

Fixed by marking the interface with NET_ADDR_SET when
the "dev_addr" module argument is supplied.

Fixes: 38008d64ea50659b ("usb: gadget: u_ether: fix race in setting MAC address in setup phase")
Cc: stable@vger.kernel.org
Signed-off-by: Marian Postevca <posteuca@mutex.one>
Link: https://lore.kernel.org/r/20220603153459.32722-1-posteuca@mutex.one
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/u_ether.c