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: <62fec09e-c881-498e-9ac0-d0a6de665f16@rowland.harvard.edu>
Date: Wed, 27 Sep 2023 09:43:37 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Douglas Anderson <dianders@...omium.org>
Cc: Jakub Kicinski <kuba@...nel.org>, Hayes Wang <hayeswang@...ltek.com>,
  "David S . Miller" <davem@...emloft.net>, linux-usb@...r.kernel.org,
  Grant Grundler <grundler@...omium.org>, Edward Hill <ecgh@...omium.org>,
  andre.przywara@....com, bjorn@...k.no, edumazet@...gle.com, gaul@...l.org,
  horms@...nel.org, linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
  pabeni@...hat.com
Subject: Re: [PATCH 2/3] r8152: Retry register reads/writes

On Tue, Sep 26, 2023 at 02:27:27PM -0700, Douglas Anderson wrote:
> +
> +static
> +int r8152_control_msg(struct usb_device *udev, unsigned int pipe, __u8 request,
> +		      __u8 requesttype, __u16 value, __u16 index, void *data,
> +		      __u16 size, const char *msg_tag)
> +{
> +	int i;
> +	int ret;
> +
> +	for (i = 0; i < REGISTER_ACCESS_TRIES; i++) {
> +		ret = usb_control_msg(udev, pipe, request, requesttype,
> +				      value, index, data, size,
> +				      USB_CTRL_GET_TIMEOUT);
> +
> +		/* No need to retry or spam errors if the USB device got
> +		 * unplugged; just return immediately.
> +		 */
> +		if (udev->state == USB_STATE_NOTATTACHED)
> +			return ret;

Rather than testing udev->state, it would be better to check whether
ret == -ENODEV.  udev->state is meant primarily for use by the USB core
and it's subject to races.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ