mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.4 PATCH] Don't panic on IDE DMA errors
@ 2005-11-28 12:22 Marcelo Tosatti
  2005-12-31 10:01 ` Andre Hedrick
  0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2005-11-28 12:22 UTC (permalink / raw)
  To: Andre Hedrick, Bartlomiej Zolnierkiewicz, Chris Ross
  Cc: Alan Cox, linux-kernel



diff-tree e8f3e8dd41308fb66c026f51bb86b23205ad48c1 (from 0b85d6aa75faefe28d90362424035ef7b349974c)
Author: Chris Ross <lak1646@tebibyte.org>
Date:   Wed Nov 23 15:56:00 2005 +0000

    [PATCH] Don't panic on IDE DMA errors
    
    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.

diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 3f6a0aa..6fc6f77 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -899,11 +899,13 @@ static ide_startstop_t ide_dma_timeout_r
 	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;
 }

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

* Re: [2.4 PATCH] Don't panic on IDE DMA errors
  2005-11-28 12:22 [2.4 PATCH] Don't panic on IDE DMA errors Marcelo Tosatti
@ 2005-12-31 10:01 ` Andre Hedrick
  2006-01-01 11:00   ` Chris Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Andre Hedrick @ 2005-12-31 10:01 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Bartlomiej Zolnierkiewicz, Chris Ross, Alan Cox, linux-kernel


What was the panic base on error?
It should have aborted the request and block resends it.
However, the logic seems sane and if the request is lost on error this
would corrupt if it did not panic.

Is there a clear way to reproduce this in a controlled manner?

IE the goal would be to test data integerity on the events.

Cheers,

Andre Hedrick
LAD Storage Consulting Group

On Mon, 28 Nov 2005, Marcelo Tosatti wrote:

> 
> 
> diff-tree e8f3e8dd41308fb66c026f51bb86b23205ad48c1 (from 0b85d6aa75faefe28d90362424035ef7b349974c)
> Author: Chris Ross <lak1646@tebibyte.org>
> Date:   Wed Nov 23 15:56:00 2005 +0000
> 
>     [PATCH] Don't panic on IDE DMA errors
>     
>     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.
> 
> diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
> index 3f6a0aa..6fc6f77 100644
> --- a/drivers/ide/ide-io.c
> +++ b/drivers/ide/ide-io.c
> @@ -899,11 +899,13 @@ static ide_startstop_t ide_dma_timeout_r
>  	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;
>  }
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


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

* Re: [2.4 PATCH] Don't panic on IDE DMA errors
  2005-12-31 10:01 ` Andre Hedrick
@ 2006-01-01 11:00   ` Chris Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Chris Ross @ 2006-01-01 11:00 UTC (permalink / raw)
  To: Andre Hedrick
  Cc: Marcelo Tosatti, Bartlomiej Zolnierkiewicz, Chris Ross, Alan Cox,
	linux-kernel

Hi Andre,

Andre Hedrick escreveu:
> What was the panic base on error?

This thread covers the initial discovery and diagnosis of the bug...
http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2005-November/032464.html

Regards,
Chris R.

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

end of thread, other threads:[~2006-01-01 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-28 12:22 [2.4 PATCH] Don't panic on IDE DMA errors Marcelo Tosatti
2005-12-31 10:01 ` Andre Hedrick
2006-01-01 11:00   ` Chris Ross

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

Powered by JetHome