Re: [PATCH] net: usb: rtl8150: don't incorrectly assign random MAC addresses

From: Anant Thazhemadam
Date: Sat Oct 10 2020 - 18:52:54 EST


Hi,

On 10/10/20 10:29 pm, Jakub Kicinski wrote:
> On Sat, 10 Oct 2020 12:14:59 +0530 Anant Thazhemadam wrote:
>> get_registers() directly returns the return value of
>> usb_control_msg_recv() - 0 if successful, and negative error number
>> otherwise.
> Are you expecting Greg to take this as a part of some USB subsystem
> changes? I don't see usb_control_msg_recv() in my tree, and the
> semantics of usb_control_msg() are not what you described.

No, I'm not. usb_control_msg_recv() is an API that was recently
introduced, and get_registers() in rtl8150.c was also modified to
use it in order to prevent partial reads.

By your tree, I assume you mean
    https://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git/
(it was the only one I could find).

I don't see the commit that this patch is supposed to fix in your
tree either... :/

Nonetheless, this commit fixes an issue that was applied to the
networking tree, and has made its way into linux-next as well, if
I'm not mistaken.

>> However, in set_ethernet_addr(), this return value is incorrectly
>> checked.
>>
>> Since this return value will never be equal to sizeof(node_id), a
>> random MAC address will always be generated and assigned to the
>> device; even in cases when get_registers() is successful.
>>
>> Correctly modifying the condition that checks if get_registers() was
>> successful or not fixes this problem, and copies the ethernet address
>> appropriately.
>>
>> Fixes: f45a4248ea4c ("set random MAC address when set_ethernet_addr() fails")
>> Signed-off-by: Anant Thazhemadam <anant.thazhemadam@xxxxxxxxx>
> The fixes tag does not follow the standard format:
>
> Fixes tag: Fixes: f45a4248ea4c ("set random MAC address when set_ethernet_addr() fails")
> Has these problem(s):
> - Subject does not match target commit subject
> Just use
> git log -1 --format='Fixes: %h ("%s")'
>
>
> Please put the relevant maintainer in the To: field of the email, and
> even better - also mark the patch as [PATCH net], since it's a
> networking fix.

The script I've been using for sending patches in had been configured to CC
the maintainer(s) and respective mailing list(s). Sorry about that.

I will put the relevant maintainer in the To: field, fix the Fixes tag, and
mark the patch as [PATCH net] as well and send in a v2.

Thank you for your time.

Thanks,
Anant