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: <0b0eefa5-71b6-dc08-d103-72b9aebd9237@zhaoxin.com>
Date: Thu, 29 Feb 2024 19:19:49 +0800
From: "WeitaoWang-oc@...oxin.com" <WeitaoWang-oc@...oxin.com>
To: Oliver Neukum <oneukum@...e.com>, <stern@...land.harvard.edu>,
	<gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <linux-scsi@...r.kernel.org>,
	<usb-storage@...ts.one-eyed-alien.net>
CC: <WeitaoWang@...oxin.com>, <stable@...r.kernel.org>
Subject: Re: [PATCH v2] USB:UAS:return ENODEV when submit urbs fail with
 device not attached.

On 2024/2/28 22:47, Oliver Neukum wrote:

>> I'm not sure I fully understand what your mean.
>> Whether the above code is more reasonable? If not,could you give me some
>> suggestion? Thanks for your help!
> 
> You want to change uas_submit_urbs() to return the reason for
> errors, because -ENODEV needs to be handled differently. That
> is good.
> But why don't you just do
> 
> return err;
> 
> unconditionally? There is no point in using SCSI_MLQUEUE_DEVICE_BUSY

I got it, Thanks. New patch would like this sample:

@@ -562,9 +561,9 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,

  	lockdep_assert_held(&devinfo->lock);
  	if (cmdinfo->state & SUBMIT_STATUS_URB) {
-		urb = uas_submit_sense_urb(cmnd, GFP_ATOMIC);
-		if (!urb)
-			return SCSI_MLQUEUE_DEVICE_BUSY;
+		err = uas_submit_sense_urb(cmnd, GFP_ATOMIC);
+		if (err)
+			return err;
  		cmdinfo->state &= ~SUBMIT_STATUS_URB;
  	}
@@ -582,7 +581,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
  		if (err) {
  			usb_unanchor_urb(cmdinfo->data_in_urb);
  			uas_log_cmd_state(cmnd, "data in submit err", err);
-			return SCSI_MLQUEUE_DEVICE_BUSY;
+			return err;
  		}

When alloc urb fail in the same function uas_submit_urbs,
whether we should replace SCSI_MLQUEUE_DEVICE_BUSY with generic
error code -ENOMEM? Such like this:

@@ -572,7 +571,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,
  		cmdinfo->data_in_urb = uas_alloc_data_urb(devinfo, GFP_ATOMIC,
  							cmnd, DMA_FROM_DEVICE);
  		if (!cmdinfo->data_in_urb)
-			return SCSI_MLQUEUE_DEVICE_BUSY;
+			return -ENOMEM;
  		cmdinfo->state &= ~ALLOC_DATA_IN_URB;
  	}

Thanks and Best regards,
Weitao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ