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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210813162439.1779bf63@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date:   Fri, 13 Aug 2021 16:24:39 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Petko Manolov <petko.manolov@...sulko.com>
Cc:     netdev@...r.kernel.org, paskripkin@...il.com,
        stable@...r.kernel.org, davem@...emloft.net
Subject: Re: [PATCH] net: usb: pegasus: ignore the return value from
 set_registers();

On Thu, 12 Aug 2021 11:23:51 +0300 Petko Manolov wrote:
> The return value need to be either ignored or acted upon, otherwise 'deadstore'
> clang check would yell at us.  I think it's better to just ignore what this
> particular call of set_registers() returns.  The adapter defaults are sane and
> it would be operational even if the register write fail.
> 
> Signed-off-by: Petko Manolov <petko.manolov@...sulko.com>
> ---
>  drivers/net/usb/pegasus.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> index 652e9fcf0b77..49cfc720d78f 100644
> --- a/drivers/net/usb/pegasus.c
> +++ b/drivers/net/usb/pegasus.c
> @@ -433,7 +433,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
>  	data[2] = loopback ? 0x09 : 0x01;
>  
>  	memcpy(pegasus->eth_regs, data, sizeof(data));
> -	ret = set_registers(pegasus, EthCtrl0, 3, data);
> +	set_registers(pegasus, EthCtrl0, 3, data);
>  
>  	if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
>  	    usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||

This one is not added by the recent changes as I initially thought, 
the driver has always checked this return value. The recent changes 
did this:

        ret = set_registers(pegasus, EthCtrl0, 3, data);
 
        if (usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS ||
            usb_dev_id[pegasus->dev_index].vendor == VENDOR_LINKSYS2 ||
            usb_dev_id[pegasus->dev_index].vendor == VENDOR_DLINK) {
                u16 auxmode;
-               read_mii_word(pegasus, 0, 0x1b, &auxmode);
+               ret = read_mii_word(pegasus, 0, 0x1b, &auxmode);
+               if (ret < 0)
+                       goto fail;
                auxmode |= 4;
                write_mii_word(pegasus, 0, 0x1b, &auxmode);
        }
 
+       return 0;
+fail:
+       netif_dbg(pegasus, drv, pegasus->net, "%s failed\n", __func__);
        return ret;
}

now the return value of set_registeres() is ignored. 

Seems like  a better fix would be to bring back the error checking, 
why not?

Please remember to add a fixes tag.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ