[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d44d8c784f9df6f55dcf494c9c21cd11b16338d4.camel@perches.com>
Date: Sat, 03 Oct 2020 14:35:23 -0700
From: Joe Perches <joe@...ches.com>
To: Anant Thazhemadam <anant.thazhemadam@...il.com>
Cc: linux-kernel-mentees@...ts.linuxfoundation.org,
syzbot+abbc768b560c84d92fd3@...kaller.appspotmail.com,
Petko Manolov <petkan@...leusys.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-usb@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] net: usb: rtl8150: set random MAC address when
set_ethernet_addr() fails
On Sun, 2020-10-04 at 02:49 +0530, Anant Thazhemadam wrote:
> When get_registers() fails, in set_ethernet_addr(),the uninitialized
> value of node_id gets copied as the address. This can be considered as
> set_ethernet_addr() itself failing.
[]
> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
[]
> @@ -909,7 +914,10 @@ static int rtl8150_probe(struct usb_interface *intf,
> goto out1;
> }
> fill_skb_pool(dev);
> - set_ethernet_addr(dev);
> + if (!set_ethernet_addr(dev)) {
> + dev_err(&intf->dev, "assigining a random MAC address\n");
> + eth_hw_addr_random(dev->netdev);
4 things:
o Typo for assigning
o Reverse the assignment and message to show the new random MAC
o This should use netdev_<level>
o Is this better as error or notification?
if (!set_ethernet_addr(dev)) {
eth_hw_addr_random(dev->netdev);
netdev_notice(dev->netdev, "Assigned a random MAC: %pM\n",
dev->netdev->dev_addr);
}
Powered by blists - more mailing lists