Skip to contentSkip to conversation

usb: uas: set host status byte on data completion error

PATCH RESEND In review Shantanu Goel 2 participants 2 messages Jun 7, 2024 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#1 lore raw

PATCH RESEND 1/1 usb: uas: set host status byte on data completion error

In reply to a message not in the archive

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.
---
 drivers/usb/storage/uas.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/storage/uas.c +1 -0
index 451d9569163a..f794cb39cc31 100644
@@ -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);
 	}
Signature · 1 line
2.43.0
maintainer Acked-by on v1 1/1
#2 lore raw
Quoted 9 lines · Shantanu Goel

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.