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

Tom Rini trini at konsulko.com
Tue Mar 17 15:02:16 CET 2026


On Tue, Mar 17, 2026 at 04:38:29PM +0400, Alexey Charkov wrote:
> On Mon, Mar 16, 2026 at 8:42 PM Alexey Charkov <alchark at flipper.net> wrote:
> >
> > 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)) {
> >
> > ---
> 
> I noticed that Tom applied a patch by Macpaul Lin [1] which does
> pretty much the same thing, which had already been reviewed and which
> I haven't noticed before submitting mine (it landed in next nearly
> simultaneously with me sending this out).
> 
> FWIW, I can confirm that Macpaul Lin's patch also fixes the issue I
> had with my Foresee FEUDNN064G-C2G07 UFS chip, so my patch here can be
> dropped.

Thanks for the update!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20260317/8d7aa7ce/attachment.sig>


More information about the U-Boot mailing list