public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ide-cd: prevent null pointer deref via cdrom_newpc_intr
@ 2009-06-18 13:48 Rainer Weikusat
  2009-06-18 14:39 ` Borislav Petkov
  0 siblings, 1 reply; 11+ messages in thread
From: Rainer Weikusat @ 2009-06-18 13:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: petkovbb

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 */

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-06-20 11:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 13:48 [PATCH] ide-cd: prevent null pointer deref via cdrom_newpc_intr Rainer Weikusat
2009-06-18 14:39 ` 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-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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox