Re: Oops when using growisofs

Jens Axboe
2008-06-26T18:41:37Z

On Thu, Jun 26 2008, Michael Buesch wrote:
> On Thursday 26 June 2008 20:36:11 Jens Axboe wrote:
> > Something like this, totally untested...
> >
> > diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
> > index 68e7f19..5c1e663 100644
> > --- a/drivers/ide/ide-cd.c
> > +++ b/drivers/ide/ide-cd.c
> > @@ -1308,13 +1308,29 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
> > req.cmd_flags |= REQ_QUIET;
> >
> > stat = ide_cd_queue_pc(drive, &req);
> > - if (stat == 0) {
> > - *capacity = 1 + be32_to_cpu(capbuf.lba);
> > - *sectors_per_frame =
> > - be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
> > + if (stat)
> > + return stat;
> > +
> > + /*
> > + * Sanity check the given block size
> > + */
> > + switch (capbuf.blocklen) {
> > + case 512:
> > + case 1024:
> > + case 2048:
> > + case 4096:
> > + break;
> > + default:
> > + printk(KERN_ERR "ide-cd: weird block size %u\n",
> > + capbuf.blocklen);
> > + printk(KERN_ERR "ide-cd: default to 2kb block size\n");
>
> KERN_WARNING

It's pretty serious, so...

> > + capbuf.blocklen = 2048;
> > + break;
> > }
> >
> > - return stat;
> > + *capacity = 1 + be32_to_cpu(capbuf.lba);
> > + *sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
> > + return 0;
> > }
> >
> > static int cdrom_read_tocentry(ide_drive_t *drive, int trackno, int msf_flag,
> >
>
> I'll test this. Thanks a lot. :)
> However I cannot reproduce the bug. So I cannot tell whether it fixes it.

The patch wont hurt, probably we should just add it just in case.

--
Jens Axboe