linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: bugzilla-daemon@bugzilla.kernel.org
Cc: linux-ide@vger.kernel.org
Subject: Re: [Bug 13399] kernel crash SONY DVD-ROM with cd
Date: Wed, 10 Jun 2009 13:18:50 +0200	[thread overview]
Message-ID: <200906101318.50244.bzolnier@gmail.com> (raw)
In-Reply-To: <200906091712.n59HCI72026129@demeter.kernel.org>

On Tuesday 09 June 2009 19:12:18 bugzilla-daemon@bugzilla.kernel.org wrote:
> http://bugzilla.kernel.org/show_bug.cgi?id=13399
> 
> 
> 
> 
> 
> --- Comment #18 from Hans de Bruin <bruinjm@xs4all.nl>  2009-06-09 17:12:18 ---
> Created an attachment (id=21831)
>  --> (http://bugzilla.kernel.org/attachment.cgi?id=21831)
> debug1 dmesg

Hans, thanks for the debug data!

ide-cd: ide_cd_queue_pc: cmd[0]: 0x51, write: 0x0, timeout: 1750, cmd_flags: 0x8000
ide-cd: ide_cd_do_request: cmd: 0x51, block: 18446744073709551615
ide_cd_do_request: dev hda: type=a, flags=108a640
  sector 18446744073709551615, nr/cnr 0/0
  bio (null), biotail (null), buffer (null), data ffff88011b849ba0, len 2
ide-cd: cdrom_do_block_pc: rq->cmd[0]: 0x51, rq->cmd_type: 0xa
ide-cd: cdrom_newpc_intr: cmd: 0x51, write: 0x0
ide-cd: cdrom_newpc_intr: DRQ: stat: 0x58, thislen: 2
ide-cd: ide_cd_check_ireason: ireason: 0x2, rw: 0x0
ide-cd: cdrom_newpc_intr: data transfer, rq->cmd_type: 0xa, ireason: 0x2
ide-cd: cdrom_newpc_intr: cmd: 0x51, write: 0x0
ide-cd: cdrom_newpc_intr: DRQ: stat: 0x50, thislen: 0
ide-cd: ide_cd_request_sense_fixup: rq->cmd[0]: 0x51
#3
ide-cd: ide_cd_queue_pc: cmd[0]: 0x51, write: 0x0, timeout: 1750, cmd_flags: 0x8000
ide-cd: ide_cd_do_request: cmd: 0x51, block: 18446744073709551615
ide_cd_do_request: dev hda: type=a, flags=108a640
  sector 18446744073709551615, nr/cnr 0/0
  bio (null), biotail (null), buffer (null), data ffff88011b849ba0, len 32
ide-cd: cdrom_do_block_pc: rq->cmd[0]: 0x51, rq->cmd_type: 0xa
ide-cd: cdrom_newpc_intr: cmd: 0x51, write: 0x0
ide-cd: cdrom_newpc_intr: DRQ: stat: 0x58, thislen: 30
ide-cd: ide_cd_check_ireason: ireason: 0x2, rw: 0x0
ide-cd: cdrom_newpc_intr: data transfer, rq->cmd_type: 0xa, ireason: 0x2
ide-cd: cdrom_newpc_intr: cmd: 0x51, write: 0x0
ide-cd: cdrom_newpc_intr: DRQ: stat: 0x50, thislen: 2
ide-cd: ide_cd_request_sense_fixup: rq->cmd[0]: 0x51
#3
BUG: unable to handle kernel NULL pointer dereference at 0000000000000048

The above command sequence corresponds to requests generated by
drivers/cdrom/cdrom.c::cdrom_get_disc_info()

	/* set up command and get the disc info */
	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
	cgc.cmd[8] = cgc.buflen = 2;
	cgc.quiet = 1;

	if ((ret = cdo->generic_packet(cdi, &cgc)))
		return ret;

	/* not all drives have the same disc_info length, so requeue
	 * packet with the length the drive tells us it can supply
	 */
	buflen = be16_to_cpu(di->disc_information_length) +
		     sizeof(di->disc_information_length);

	if (buflen > sizeof(disc_information))
		buflen = sizeof(disc_information);

	cgc.cmd[8] = cgc.buflen = buflen;
	if ((ret = cdo->generic_packet(cdi, &cgc)))
		return ret;

and we are hitting BUG because of the limitation of block layer, only
rq->bio requests can be partially completed:

int __blk_end_request(struct request *rq, int error, unsigned int nr_bytes)
{
	if (rq->bio && __end_that_request_first(rq, error, nr_bytes))
		return 1;

	add_disk_randomness(rq->rq_disk);

	end_that_request_last(rq, error);

	return 0;
}

so on error we complete the request fully instead of partially and later
we try to complete the already freed request.

Borislav, there are actually two issues here to investigate:

* seems like we need to check for rq->bio before calling ide_cd_error_cmd()
  to make the regression go away (IOW we shouldn't don't do partial "good"
  completions for !rq->bio requests)

* potentially revise our strategy of handling GPCMD_READ_DISC_INFO packet
  command returning less data than requested (in this particular case we ask
  for 32 bytes, device gives us only 30 bytes but returns good status)

  reply	other threads:[~2009-06-10 11:13 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 16:54 [Bug 13399] New: kernel crash SONY DVD-ROM with cd bugzilla-daemon
2009-05-28 17:07 ` [Bug 13399] " bugzilla-daemon
2009-05-29  7:25 ` bugzilla-daemon
2009-06-04 17:23 ` bugzilla-daemon
2009-06-05  7:05 ` bugzilla-daemon
2009-06-05 13:51 ` bugzilla-daemon
2009-06-05 13:52 ` bugzilla-daemon
2009-06-05 13:52 ` bugzilla-daemon
2009-06-05 13:54 ` bugzilla-daemon
2009-06-05 13:55 ` bugzilla-daemon
2009-06-05 13:57 ` bugzilla-daemon
2009-06-06 19:35 ` bugzilla-daemon
2009-06-06 19:37 ` bugzilla-daemon
2009-06-08 16:05 ` bugzilla-daemon
2009-06-08 16:05 ` bugzilla-daemon
2009-06-08 16:06 ` bugzilla-daemon
2009-06-08 16:06 ` bugzilla-daemon
2009-06-08 16:07 ` bugzilla-daemon
2009-06-08 16:07 ` bugzilla-daemon
2009-06-09  5:31 ` bugzilla-daemon
2009-06-09 14:22 ` bugzilla-daemon
2009-06-09 15:57 ` bugzilla-daemon
2009-06-09 17:11 ` bugzilla-daemon
2009-06-09 17:12 ` bugzilla-daemon
2009-06-10 11:18   ` Bartlomiej Zolnierkiewicz [this message]
2009-06-10 11:14 ` bugzilla-daemon
2009-06-13 16:29 ` bugzilla-daemon
2009-06-13 16:59   ` Bartlomiej Zolnierkiewicz
2009-06-14 10:06     ` Borislav Petkov
2009-06-14 12:32       ` Bartlomiej Zolnierkiewicz
2009-06-14 13:02         ` Borislav Petkov
2009-06-15  6:27           ` Borislav Petkov
2009-06-13 16:54 ` bugzilla-daemon
2009-06-14 10:06 ` bugzilla-daemon
2009-06-14 12:27 ` bugzilla-daemon
2009-06-14 13:02 ` bugzilla-daemon
2009-06-15  6:28 ` bugzilla-daemon
2009-06-15 16:20 ` bugzilla-daemon
2009-06-15 16:23 ` bugzilla-daemon
2009-06-15 17:47 ` bugzilla-daemon
2009-06-16  6:28 ` bugzilla-daemon
2009-06-16  6:29 ` bugzilla-daemon
2009-06-16 15:45 ` bugzilla-daemon
2009-06-18  8:19 ` bugzilla-daemon
2009-06-18 12:12 ` bugzilla-daemon
2009-06-18 13:36 ` bugzilla-daemon
2009-06-18 16:22 ` bugzilla-daemon
2009-06-19  4:31 ` bugzilla-daemon
2009-06-19  4:35 ` bugzilla-daemon
2009-06-19  4:37 ` bugzilla-daemon
2009-06-22  6:37 ` bugzilla-daemon
2009-06-22  8:03 ` bugzilla-daemon
2009-06-22  8:04 ` bugzilla-daemon
2009-06-22 15:23 ` bugzilla-daemon
2009-06-22 15:25 ` bugzilla-daemon
2009-06-22 15:49 ` bugzilla-daemon
2009-06-23  4:07 ` bugzilla-daemon
2009-06-23  5:37 ` bugzilla-daemon
2009-06-23  5:37 ` bugzilla-daemon
2009-06-24 20:47 ` bugzilla-daemon
2009-06-25 10:02 ` bugzilla-daemon
2009-07-03 12:09 ` bugzilla-daemon
2009-09-10 12:03 ` bugzilla-daemon
2009-09-10 12:24 ` bugzilla-daemon
2009-09-10 13:20 ` bugzilla-daemon
2009-09-10 13:23 ` bugzilla-daemon
2009-09-11  5:45 ` bugzilla-daemon
2009-09-11  5:49 ` bugzilla-daemon
2009-09-11 15:04 ` bugzilla-daemon
2009-09-17  6:39 ` bugzilla-daemon
2009-09-17  6:47 ` bugzilla-daemon
2009-09-17  6:57 ` bugzilla-daemon
2009-09-26  6:10 ` bugzilla-daemon
2009-09-27 16:19 ` bugzilla-daemon
2009-09-27 16:52 ` bugzilla-daemon
2010-01-19 21:50 ` bugzilla-daemon
2010-01-19 22:52 ` bugzilla-daemon
     [not found] <bug-13399-11633@https.bugzilla.kernel.org/>
2010-11-30  8:54 ` bugzilla-daemon
2011-02-06 15:45 ` bugzilla-daemon
2011-02-06 15:46 ` bugzilla-daemon

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=200906101318.50244.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).