Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-03 Thread Anant Thazhemadam
On 04/10/20 1:08 am, Joe Perches wrote: > On Thu, 2020-10-01 at 13:02 +0530, Anant Thazhemadam wrote: >> When get_registers() fails (which happens when usb_control_msg() fails) >> in set_ethernet_addr(), the uninitialized value of node_id gets copied >> as the address. > unrelated trivia: > >>

Re: [Linux-kernel-mentees][PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-03 Thread Joe Perches
On Thu, 2020-10-01 at 13:02 +0530, Anant Thazhemadam wrote: > When get_registers() fails (which happens when usb_control_msg() fails) > in set_ethernet_addr(), the uninitialized value of node_id gets copied > as the address. unrelated trivia: > diff --git a/drivers/net/usb/rtl8150.c

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Anant Thazhemadam
On 03-10-2020 04:08, David Miller wrote: > From: Anant Thazhemadam > Date: Fri, 2 Oct 2020 17:04:13 +0530 > >> But this patch is about ensuring that an uninitialized variable's >> value (whatever that may be) is not set as the ethernet address >> blindly (without any form of checking if

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Anant Thazhemadam
On 02-10-2020 19:59, Petko Manolov wrote: > On 20-10-02 17:35:25, Anant Thazhemadam wrote: >> Yes, this clears things up for me. I'll see to it that this gets done in a >> v3. > If set_ethernet_addr() fail, don't return error, but use eth_hw_addr_random() > instead to set random MAC address

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread David Miller
From: Anant Thazhemadam Date: Fri, 2 Oct 2020 17:04:13 +0530 > But this patch is about ensuring that an uninitialized variable's > value (whatever that may be) is not set as the ethernet address > blindly (without any form of checking if get_registers() worked > as expected, or not). Right, and

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Petko Manolov
On 20-10-02 17:35:25, Anant Thazhemadam wrote: > > Yes, this clears things up for me. I'll see to it that this gets done in a v3. If set_ethernet_addr() fail, don't return error, but use eth_hw_addr_random() instead to set random MAC address and continue with the probing. You can take a look

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Anant Thazhemadam
On 02-10-2020 17:24, Greg KH wrote: > On Fri, Oct 02, 2020 at 05:04:13PM +0530, Anant Thazhemadam wrote: >> On 02/10/20 7:45 am, David Miller wrote: >>> From: Anant Thazhemadam >>> Date: Thu, 1 Oct 2020 13:02:20 +0530 >>> When get_registers() fails (which happens when usb_control_msg()

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Greg KH
On Fri, Oct 02, 2020 at 05:04:13PM +0530, Anant Thazhemadam wrote: > > On 02/10/20 7:45 am, David Miller wrote: > > From: Anant Thazhemadam > > Date: Thu, 1 Oct 2020 13:02:20 +0530 > > > >> When get_registers() fails (which happens when usb_control_msg() fails) > >> in set_ethernet_addr(), the

Re: [PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-02 Thread Anant Thazhemadam
On 02/10/20 7:45 am, David Miller wrote: > From: Anant Thazhemadam > Date: Thu, 1 Oct 2020 13:02:20 +0530 > >> When get_registers() fails (which happens when usb_control_msg() fails) >> in set_ethernet_addr(), the uninitialized value of node_id gets copied >> as the address. >> >> Checking for

Re: [Linux-kernel-mentees][PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-01 Thread David Miller
From: Anant Thazhemadam Date: Thu, 1 Oct 2020 13:02:20 +0530 > When get_registers() fails (which happens when usb_control_msg() fails) > in set_ethernet_addr(), the uninitialized value of node_id gets copied > as the address. > > Checking for the return values appropriately, and handling the

[Linux-kernel-mentees][PATCH v2] net: usb: rtl8150: prevent set_ethernet_addr from setting uninit address

2020-10-01 Thread Anant Thazhemadam
When get_registers() fails (which happens when usb_control_msg() fails) in set_ethernet_addr(), the uninitialized value of node_id gets copied as the address. Checking for the return values appropriately, and handling the case wherein set_ethernet_addr() fails like this, helps in avoiding the mac