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]
Date:   Sun, 4 Dec 2022 13:48:07 +0200
From:   Leon Romanovsky <leon@...nel.org>
To:     Lucas Stach <l.stach@...gutronix.de>
Cc:     linux-usb@...r.kernel.org, netdev@...r.kernel.org,
        "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, kernel@...gutronix.de,
        patchwork-lst@...gutronix.de
Subject: Re: [PATCH 2/2] net: asix: Avoid looping when the device is
 diconnected

On Thu, Dec 01, 2022 at 06:55:25PM +0100, Lucas Stach wrote:
> We've seen device access fail with -EPROTO when the device has been
> recently disconnected and before the USB core had a chance to handle
> the disconnect hub event. It doesn't make sense to continue on trying
> to enable host access when the adapter is gone.
> 
> Signed-off-by: Lucas Stach <l.stach@...gutronix.de>
> ---
>  drivers/net/usb/asix_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> index be1e103b7a95..28b31e4da020 100644
> --- a/drivers/net/usb/asix_common.c
> +++ b/drivers/net/usb/asix_common.c
> @@ -96,7 +96,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
>  
>  	for (i = 0; i < AX_HOST_EN_RETRIES; ++i) {
>  		ret = asix_set_sw_mii(dev, in_pm);
> -		if (ret == -ENODEV || ret == -ETIMEDOUT)
> +		if (ret == -ENODEV || ret == -ETIMEDOUT || ret == -EPROTO)

It looks like you can put if (ret < 0) here,

>  			break;
>  		usleep_range(1000, 1100);
>  		ret = asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG,
> -- 
> 2.30.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ