[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YaoSkbMBk90zr3N7@kroah.com>
Date: Fri, 3 Dec 2021 13:50:25 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Marian Postevca <posteuca@...ex.one>
Cc: Felipe Balbi <balbi@...nel.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: u_ether: fix race in setting MAC address in
setup phase
On Tue, Nov 30, 2021 at 12:12:29AM +0200, Marian Postevca wrote:
> When listening for notifications through netlink of a new interface being
> registered, sporadically, it is possible for the MAC to be read as zero.
> The zero MAC address lasts a short period of time and then switches to a
> valid random MAC address.
>
> This causes problems for netd in Android, which assumes that the interface
> is malfunctioning and will not use it.
>
> In the good case we get this log:
> InterfaceController::getCfg() ifName usb0
> hwAddr 92:a8:f0:73:79:5b ipv4Addr 0.0.0.0 flags 0x1002
>
> In the error case we get these logs:
> InterfaceController::getCfg() ifName usb0
> hwAddr 00:00:00:00:00:00 ipv4Addr 0.0.0.0 flags 0x1002
>
> netd : interfaceGetCfg("usb0")
> netd : interfaceSetCfg() -> ServiceSpecificException
> (99, "[Cannot assign requested address] : ioctl() failed")
>
> The reason for the issue is the order in which the interface is setup,
> it is first registered through register_netdev() and after the MAC
> address is set.
>
> Fixed by first setting the MAC address of the net_device and after that
> calling register_netdev().
>
> Signed-off-by: Marian Postevca <posteuca@...ex.one>
> ---
> drivers/usb/gadget/function/u_ether.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
What commit does this fix? Should it go to stable kernel releases?
thanks,
greg k-h
Powered by blists - more mailing lists