Re: [syzbot] [usb-storage?] divide error in isd200_ata_command

From: Alan Stern
Date: Wed Feb 28 2024 - 14:23:37 EST


On Wed, Feb 28, 2024 at 05:20:29PM +0100, Oliver Neukum wrote:
> On 26.02.24 19:13, Alan Stern wrote:
>
> > > It oopses here:
> > >
> > > } else {
> > > if (!id[ATA_ID_SECTORS] || !id[ATA_ID_HEADS])
> > > goto too_early;
> >
> > Those two lines are debugging code you added, right?
>
> Yes, sorry about that.
>
> >
> > > sectnum = (u8)((lba % id[ATA_ID_SECTORS]) + 1);
> > > cylinder = (u16)(lba / (id[ATA_ID_SECTORS] *
> > > id[ATA_ID_HEADS]));
> > >
> > > in isd200_scsi_to_ata() because it must not be called before isd200_get_inquiry_data()
> > > has completed.
> >
> > It can't be; isd200_get_inquiry_data is called by isd200_Initialization
> > during probe before any SCSI commands are transmitted.
>
> So, you are concluding that the bisection is spurious because
> without that patch the SCSI layer would see a capacity of zero
> and not even try to read anything?

I don't know. My guess is that without this patch, the test would fail
for some reason before the SCSI layer has a chance to issue a READ command.
Maybe because of a zero capacity, like you said, or maybe something
else.

Whatever the reason, it looks like Martin's commit merely exposed a
problem which has existed all along.

Alan Stern