summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRainer Weikusat <rweikusat@mssgmbh.com>2009-06-18 17:04:00 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2009-07-02 16:51:05 -0700
commit2547a3000f19e677ab5eb7e1a9c01164f5bd7922 (patch)
tree23e561c207b9984e283e5d7a9f9c70db998d4d2d
parent86f1152e3428d3515ebaabb542fb1ca750db79c9 (diff)
ide-cd: prevent null pointer deref via cdrom_newpc_intr
commit 39c58f37a10198054c656c28202fb1e6d22fd505 upstream. 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. In order to do this, ide_complete_rq is called over ide_cd_error_cmd() to partially complete the rq. The block layer does partial completion only for requests with bio's and if the rq doesn't have one (eg 'GPCMD_READ_DISC_INFO') the request is completed as a whole and the drive->hwif->rq pointer set to NULL afterwards. When calling ide_complete_rq again to report the error, this null pointer is derefenced, resulting in a kernel crash. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=13399. Signed-off-by: Rainer Weikusat <rweikusat@mssgmbh.com> Signed-off-by: Borislav Petkov <petkovbb@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/ide/ide-cd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 925eb9e245d1..6368f5723137 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -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 */