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: <2024030530-trinity-triangle-c334@gregkh>
Date: Tue, 5 Mar 2024 13:25:55 +0000
From: Greg KH <gregkh@...uxfoundation.org>
To: Weitao Wang <WeitaoWang-oc@...oxin.com>
Cc: oneukum@...e.com, stern@...land.harvard.edu, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux-scsi@...r.kernel.org,
	usb-storage@...ts.one-eyed-alien.net, WeitaoWang@...oxin.com,
	stable@...r.kernel.org
Subject: Re: [PATCH v3] USB:UAS:return ENODEV when submit urbs fail with
 device not attached

On Fri, Mar 01, 2024 at 03:33:49AM +0800, Weitao Wang wrote:
> In the scenario of entering hibernation with udisk in the system, if the
> udisk was gone or resume fail in the thaw phase of hibernation. Its state
> will be set to NOTATTACHED. At this point, usb_hub_wq was already freezed
> and can't not handle disconnect event. Next, in the poweroff phase of
> hibernation, SYNCHRONIZE_CACHE SCSI command will be sent to this udisk
> when poweroff this scsi device, which will cause uas_submit_urbs to be
> called to submit URB for sense/data/cmd pipe. However, these URBs will
> submit fail as device was set to NOTATTACHED state. Then, uas_submit_urbs
> will return a value SCSI_MLQUEUE_DEVICE_BUSY to the caller. That will lead
> the SCSI layer go into an ugly loop and system fail to go into hibernation.
> 
> On the other hand, when we specially check for -ENODEV in function
> uas_queuecommand_lck, returning DID_ERROR to SCSI layer will cause device
> poweroff fail and system shutdown instead of entering hibernation.
> 
> To fix this issue, let uas_submit_urbs to return original generic error
> when submitting URB failed. At the same time, we need to translate -ENODEV
> to DID_NOT_CONNECT for the SCSI layer.
> 
> Suggested-by: Oliver Neukum <oneukum@...e.com>
> Cc: stable@...r.kernel.org
> Signed-off-by: Weitao Wang <WeitaoWang-oc@...oxin.com>
> ---
> v2->v3
>  - Modify the description of this patch.
>  - An error is returned directly when submitting URB fails.

This change breaks the build, please be more careful:

drivers/usb/storage/uas.c: In function ‘uas_submit_urbs’:
drivers/usb/storage/uas.c:559:21: error: unused variable ‘urb’ [-Werror=unused-variable]
  559 |         struct urb *urb;
      |                     ^~~


thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ