All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Ross <lak1646@tebibyte.org>
To: Andre Hedrick <andre@linux-ide.org>,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Greg Ungerer <gerg@snapgear.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Russell King <rmk+lkml@arm.linux.org.uk>
Subject: [PATCH] 2.4.32 Don't panic on IDE DMA errors
Date: Wed, 23 Nov 2005 15:56:00 +0000	[thread overview]
Message-ID: <43849110.2070806@tebibyte.org> (raw)

Kernel 2.4.32 and earlier can panic when trying to read a corrupted 
sector from an IDE disk.

The function ide_dma_timeout_retry can end a request early by calling 
idedisk_error, but then goes on to use the request anyway causing a 
kernel panic due to a null pointer exception. This patch fixes that.

Regards,
Chris R.


diff -urN -X dontdiff linux-2.4.32/drivers/ide/ide-io.c 
patched-linux-2.4.32/drivers/ide/ide-io.c
--- linux-2.4.32/drivers/ide/ide-io.c	2003-11-28 18:26:20.000000000 +0000
+++ patched-linux-2.4.32/drivers/ide/ide-io.c	2005-11-23 
12:33:37.000000000 +0000
@@ -899,11 +899,13 @@
  	rq = HWGROUP(drive)->rq;
  	HWGROUP(drive)->rq = NULL;

-	rq->errors = 0;
-	rq->sector = rq->bh->b_rsector;
-	rq->current_nr_sectors = rq->bh->b_size >> 9;
-	rq->hard_cur_sectors = rq->current_nr_sectors;
-	rq->buffer = rq->bh->b_data;
+	if (rq) {
+		rq->errors = 0;
+		rq->sector = rq->bh->b_rsector;
+		rq->current_nr_sectors = rq->bh->b_size >> 9;
+		rq->hard_cur_sectors = rq->current_nr_sectors;
+		rq->buffer = rq->bh->b_data;
+	}

  	return ret;
  }

             reply	other threads:[~2005-11-23 15:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-23 15:56 Chris Ross [this message]
2005-11-28 12:06 ` [PATCH] 2.4.32 Don't panic on IDE DMA errors Marcelo Tosatti

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=43849110.2070806@tebibyte.org \
    --to=lak1646@tebibyte.org \
    --cc=andre@linux-ide.org \
    --cc=gerg@snapgear.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=rmk+lkml@arm.linux.org.uk \
    /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.