mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com,
	Petko Manolov <petkan@nucleusys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
Date: Sat, 03 Oct 2020 14:35:23 -0700	[thread overview]
Message-ID: <d44d8c784f9df6f55dcf494c9c21cd11b16338d4.camel@perches.com> (raw)
In-Reply-To: <20201003211931.11544-1-anant.thazhemadam@gmail.com>

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);
	}


  reply	other threads:[~2020-10-03 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-03 21:19 Anant Thazhemadam
2020-10-03 21:35 ` Joe Perches [this message]
2020-10-03 21:45   ` Anant Thazhemadam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d44d8c784f9df6f55dcf494c9c21cd11b16338d4.camel@perches.com \
    --to=joe@perches.com \
    --cc=anant.thazhemadam@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petkan@nucleusys.com \
    --cc=syzbot+abbc768b560c84d92fd3@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®