All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rainer Weikusat <rweikusat@mssgmbh.com>
To: linux-kernel@vger.kernel.org
Cc: petkovbb@gmail.com
Subject: [PATCH] ide-cd: prevent null pointer deref via cdrom_newpc_intr
Date: Thu, 18 Jun 2009 15:48:18 +0200	[thread overview]
Message-ID: <87zlc58xgd.fsf@fever.mssgmbh.com> (raw)

From: Rainer Weikusat <rweikusat@mssgmbh.com>

With 2.6.30, the error handling code in cdrom_newpc_intr was changed
to deal with partial request failures by normally completing the 'good'
parts of a request and only 'error' the last (and presumably,
incompletely transferred) bio associated with a particular
request. This doesn't work for requests which don't have bios
associated with them ('GPCMD_READ_DISC_INFO'), because the first call
to ide_end_rq, done via ide_complete_rq in order to do the
partial completion part, returns with a code of zero for all non-bio
requests, causing the drive->hwif->rq pointer to be set to NULL. Upon
calling ide_complete_rq a second time, it is attempted to de-reference
this null pointer, resulting in a kernel crash.

Signed-Off-By: Rainer Weikusat <rweikusat@mssgmbh.com>

---

This is fixed in the linux-ide tree since at about 2009/06/10 [Bug
13399, also happens w/ TSSTcorpDVD-ROM SH-D162C], but a patch
against 2.6.30 AFAIK doesn't exist (and I didn't find the
corresponding thread before digging through all of this ...).

--- drivers/ide/ide-cd.c.orig	2009-06-18 15:10:24.000000000 +0200
+++ drivers/ide/ide-cd.c	2009-06-18 14:10:16.000000000 +0200
@@ -758,7 +758,7 @@ out_end:
 				rq->errors = -EIO;
 		}
 
-		if (uptodate == 0)
+		if (uptodate == 0 && rq->bio)
 			ide_cd_error_cmd(drive, cmd);
 
 		/* make sure it's fully ended */

             reply	other threads:[~2009-06-18 13:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 13:48 Rainer Weikusat [this message]
2009-06-18 14:39 ` [PATCH] ide-cd: prevent null pointer deref via cdrom_newpc_intr Borislav Petkov
2009-06-18 14:52   ` Rainer Weikusat
2009-06-18 15:43     ` Borislav Petkov
2009-06-18 16:18       ` Rainer Weikusat
2009-06-18 17:07         ` Borislav Petkov
2009-06-18 18:25           ` Rainer Weikusat
2009-06-18 18:25             ` Rainer Weikusat
2009-06-19  8:54             ` Borislav Petkov
2009-06-19  8:54               ` Borislav Petkov
2009-06-18 15:04   ` Rainer Weikusat
2009-06-18 16:06     ` Borislav Petkov
2009-06-20 10:27       ` Bartlomiej Zolnierkiewicz

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=87zlc58xgd.fsf@fever.mssgmbh.com \
    --to=rweikusat@mssgmbh.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=petkovbb@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.