lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201012091428.103fc2be@canb.auug.org.au>
Date:   Mon, 12 Oct 2020 09:14:28 +1100
From:   Stephen Rothwell <sfr@...b.auug.org.au>
To:     Greg KH <greg@...ah.com>
Cc:     Anant Thazhemadam <anant.thazhemadam@...il.com>,
        petkan@...leusys.com, davem@...emloft.net, kuba@...nel.org,
        linux-usb@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        linux-kernel-mentees@...ts.linuxfoundation.org,
        linux-next@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>
Subject: Re: [PATCH v2] net: usb: rtl8150: don't incorrectly assign random
 MAC addresses

Hi Greg,

On Sun, 11 Oct 2020 23:00:30 +0530 Anant Thazhemadam <anant.thazhemadam@...il.com> wrote:
>
> In set_ethernet_addr(), if get_registers() succeeds, the ethernet address
> that was read must be copied over. Otherwise, a random ethernet address
> must be assigned.
> 
> get_registers() returns 0 if successful, and negative error number
> otherwise. 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 ("net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails")
> Signed-off-by: Anant Thazhemadam <anant.thazhemadam@...il.com>
> ---
> Changes in v2:
>         * Fixed the format of the Fixes tag
>         * Modified the commit message to better describe the issue being 
>           fixed
> 
> +CCing Stephen and linux-next, since the commit fixed isn't in the networking
> tree, but is present in linux-next.
> 
>  drivers/net/usb/rtl8150.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
> index f020401adf04..bf8a60533f3e 100644
> --- a/drivers/net/usb/rtl8150.c
> +++ b/drivers/net/usb/rtl8150.c
> @@ -261,7 +261,7 @@ static void set_ethernet_addr(rtl8150_t *dev)
>  
>  	ret = get_registers(dev, IDR, sizeof(node_id), node_id);
>  
> -	if (ret == sizeof(node_id)) {
> +	if (!ret) {
>  		ether_addr_copy(dev->netdev->dev_addr, node_id);
>  	} else {
>  		eth_hw_addr_random(dev->netdev);
> -- 
> 2.25.1
> 

I will apply the above patch to the merge of the usb tree today to fix
up a semantic conflict between the usb tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ