[PATCH] scsi: Fix oversized data length in scsi_inquiry()

Alexey Charkov alchark at flipper.net
Mon Mar 16 17:41:50 CET 2026


scsi_detect_dev() sets the inquiry data length to 512, but
scsi_setup_inquiry() only sets the command up with a 255 byte length.

This causes some SCSI devices such as the Foresee FEUDNN064G-C2G07 UFS
chip to fail to respond to the inquiry command, preventing its detection.

Set the data length to the size of the scsi_inquiry_resp structure, which
is the maximum amount of data that scsi_setup_inquiry() will request.

Fixes: 570712f4bcc4 ("scsi: Extract device detection algorithm")
Signed-off-by: Alexey Charkov <alchark at flipper.net>
---
 drivers/scsi/scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 8fe6b38a8c74..6a3a91b1d32b 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -513,7 +513,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
 	pccb->target = target;
 	pccb->lun = lun;
 	pccb->pdata = tempbuff;
-	pccb->datalen = 512;
+	pccb->datalen = sizeof(struct scsi_inquiry_resp);
 	pccb->dma_dir = DMA_FROM_DEVICE;
 	scsi_setup_inquiry(pccb);
 	if (scsi_exec(dev, pccb)) {

---
base-commit: 841856ed9675b26ec517fdd00b5cc0aef8db508e
change-id: 20260316-scsi-inquiry-len-9910c4755813

Best regards,
-- 
Alexey Charkov <alchark at flipper.net>



More information about the U-Boot mailing list