Re: Oops when using growisofs

From: Michael Buesch
Date: Thu Jun 26 2008 - 14:40:07 EST


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

> + 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.

--
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/