linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
	Petko Manolov <petkan@nucleusys.com>,
	netdev@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	linux-kernel-mentees@lists.linuxfoundation.org,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [Linux-kernel-mentees] [PATCH] net: usb: rtl8150: don't incorrectly assign random MAC addresses
Date: Sat, 10 Oct 2020 12:20:24 -0700	[thread overview]
Message-ID: <20201010122024.0ec7c2f1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <e772b9f0-f5cd-c50b-86a7-fde22b6e13e3@gmail.com>

On Sun, 11 Oct 2020 00:14:05 +0530 Anant Thazhemadam wrote:
> Ah, my apologies. You're right. It doesn't look like those helpers have made
> their way into the networking tree yet.
> 
> (This gets mentioned here as well,
>     https://www.mail-archive.com/netdev@vger.kernel.org/msg357843.html)
> 
> The commit ID pointed to by the fixes tag is correct.
> The change introduced by said commit looks right, but is logically incorrect.
> 
> get_registers() directly returns the return value of usb_control_msg_recv(),
> and usb_control_msg_recv() returns 0 on success and negative error number
> otherwise.
> 
> (You can find more about the new helpers here
>     https://lore.kernel.org/alsa-devel/20200914153756.3412156-1-gregkh@linuxfoundation.org/ )
> 
> The commit ID mentioned introduces a change that is supposed to copy over
> the ethernet only when get_registers() succeeds, i.e., a complete read occurs,
> and generate and set a random ethernet address otherwise (reading the
> commit message should give some more insight).
> 
> The condition that checks if get_registers() succeeds (as specified in f45a4248ea4c)
> was,
>     ret == sizeof(node_id)
> where ret is the return value of get_registers().
> 
> However, ret will never equal sizeof(node_id), since ret can only be equal to 0
> or a negative number.
> 
> Thus, even in case where get_registers() succeeds, a randomly generated MAC
> address would get copied over, instead of copying the appropriate ethernet
> address, which is logically incorrect and not optimal.
> 
> Hence, we need to modify this to check if (ret == 0), and copy over the correct
> ethernet address in that case, instead of randomly generating one and assigning
> that.

I see... so we ended up with your fix applied to net, and Petko's
rework applied to the usb/usb-next tree.

What you're actually fixing is the improper resolution of the resulting
conflict in linux-next!

CCing Stephen and linux-next.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  reply	other threads:[~2020-10-10 19:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-10  6:44 [Linux-kernel-mentees] [PATCH] net: usb: rtl8150: don't incorrectly assign random MAC addresses Anant Thazhemadam
2020-10-10 16:59 ` Jakub Kicinski
2020-10-10 18:04   ` Anant Thazhemadam
2020-10-10 18:16     ` Jakub Kicinski
2020-10-10 18:44       ` Anant Thazhemadam
2020-10-10 19:20         ` Jakub Kicinski [this message]
2020-10-11 17:30 ` [Linux-kernel-mentees] [PATCH v2] " Anant Thazhemadam
2020-10-11 17:59   ` Jakub Kicinski
2020-10-11 18:33     ` Joe Perches
2020-10-11 19:31       ` Petko Manolov
2020-10-11 20:14         ` Joe Perches
2020-10-11 22:14   ` Stephen Rothwell
2020-10-15 21:59     ` Stephen Rothwell
2020-10-15 22:24       ` Jakub Kicinski
2020-10-15 22:37         ` Jakub Kicinski
2020-10-18 19:54           ` Jakub Kicinski

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=20201010122024.0ec7c2f1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=anant.thazhemadam@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=petkan@nucleusys.com \
    --cc=sfr@canb.auug.org.au \
    /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;
as well as URLs for NNTP newsgroup(s).