public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND][PATCH] usb: uas: set host status byte on data completion error
       [not found] <87msnx4ec6.fsf.ref@yahoo.com>
@ 2024-06-07  3:32 ` Shantanu Goel
  2024-06-07  5:58   ` Oliver Neukum
  0 siblings, 1 reply; 2+ messages in thread
From: Shantanu Goel @ 2024-06-07  3:32 UTC (permalink / raw)
  To: Oliver Neukum; +Cc: linux-usb

Set the host status byte when a data completion error is encountered
otherwise the upper layer may end up using the invalid zero'ed data.
The following output was observed from scsi/sd.c prior to this fix.

[   11.872824] sd 0:0:0:1: [sdf] tag#9 data cmplt err -75 uas-tag 1 inflight:
[   11.872826] sd 0:0:0:1: [sdf] tag#9 CDB: Read capacity(16) 9e 10 00 00 00 00 00 00 00 00 00 00 00 20 00 00
[   11.872830] sd 0:0:0:1: [sdf] Sector size 0 reported, assuming 512.

Signed-off-by: Shantanu Goel <sgoel01@yahoo.com>
---
 drivers/usb/storage/uas.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index 451d9569163a..f794cb39cc31 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -422,6 +422,7 @@ static void uas_data_cmplt(struct urb *urb)
 			uas_log_cmd_state(cmnd, "data cmplt err", status);
 		/* error: no data transfered */
 		scsi_set_resid(cmnd, sdb->length);
+		set_host_byte(cmnd, DID_ERROR);
 	} else {
 		scsi_set_resid(cmnd, sdb->length - urb->actual_length);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND][PATCH] usb: uas: set host status byte on data completion error
  2024-06-07  3:32 ` [RESEND][PATCH] usb: uas: set host status byte on data completion error Shantanu Goel
@ 2024-06-07  5:58   ` Oliver Neukum
  0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2024-06-07  5:58 UTC (permalink / raw)
  To: Shantanu Goel, Oliver Neukum
  Cc: linux-usb@vger.kernel.org, linux-scsi@vger.kernel.org



On 07.06.24 05:32, Shantanu Goel wrote:
> Set the host status byte when a data completion error is encountered
> otherwise the upper layer may end up using the invalid zero'ed data.
> The following output was observed from scsi/sd.c prior to this fix.
> 
> [   11.872824] sd 0:0:0:1: [sdf] tag#9 data cmplt err -75 uas-tag 1 inflight:
> [   11.872826] sd 0:0:0:1: [sdf] tag#9 CDB: Read capacity(16) 9e 10 00 00 00 00 00 00 00 00 00 00 00 20 00 00
> [   11.872830] sd 0:0:0:1: [sdf] Sector size 0 reported, assuming 512.
> 
> Signed-off-by: Shantanu Goel <sgoel01@yahoo.com>
Acked-by: Oliver Neukum <oneukum@suse.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-07  5:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87msnx4ec6.fsf.ref@yahoo.com>
2024-06-07  3:32 ` [RESEND][PATCH] usb: uas: set host status byte on data completion error Shantanu Goel
2024-06-07  5:58   ` Oliver Neukum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox