public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Michael Buesch <mb@bu3sch.de>
Cc: Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Oops when using growisofs
Date: Thu, 26 Jun 2008 20:41:25 +0200	[thread overview]
Message-ID: <20080626184124.GJ20851@kernel.dk> (raw)
In-Reply-To: <200806262039.04678.mb@bu3sch.de>

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


  reply	other threads:[~2008-06-26 18:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-22 16:18 Oops when using growisofs Michael Buesch
2008-06-22 21:22 ` Arnd Bergmann
2008-06-22 21:31   ` Arnd Bergmann
2008-06-22 22:09     ` Michael Buesch
2008-06-22 22:05   ` Michael Buesch
2008-06-22 22:28     ` Michael Buesch
2008-06-23  6:34       ` Andrew Morton
2008-06-23  6:59         ` Nick Piggin
2008-06-24 17:28         ` Jan Kara
2008-06-24 18:39           ` Michael Buesch
2008-06-25  1:42             ` Arnd Bergmann
2008-06-25  9:37             ` Jan Kara
2008-06-25  9:46               ` Michael Buesch
2008-06-26 17:05                 ` Jan Kara
2008-06-26 18:11                   ` Jens Axboe
2008-06-26 18:21                     ` Michael Buesch
2008-06-26 18:36                       ` Jens Axboe
2008-06-26 18:39                         ` Michael Buesch
2008-06-26 18:41                           ` Jens Axboe [this message]
2008-06-29 19:39                         ` Michael Buesch
2008-07-09 18:46                         ` Jan Kara
2008-07-22  9:25                         ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080626184124.GJ20851@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@bu3sch.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox