From linux-kernel-owner+willy=40w.ods.org-S932161AbVK1SGR@vger.kernel.org Mon Nov 28 19:07:41 2005 Return-Path: Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by mail.w.ods.org (8.13.3/8.13.3) with ESMTP id jASI6qJo025212 for ; Mon, 28 Nov 2005 19:07:01 +0100 (CET) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932161AbVK1SGR (ORCPT ); Mon, 28 Nov 2005 13:06:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932156AbVK1SFw (ORCPT ); Mon, 28 Nov 2005 13:05:52 -0500 Received: from hera.kernel.org ([140.211.167.34]:37354 "EHLO hera.kernel.org") by vger.kernel.org with ESMTP id S932148AbVK1SFW (ORCPT ); Mon, 28 Nov 2005 13:05:22 -0500 Received: from logos.cnet (localhost [127.0.0.1]) by hera.kernel.org (8.13.1/8.13.1) with ESMTP id jASI4P1f014113; Mon, 28 Nov 2005 10:04:26 -0800 Received: by logos.cnet (Postfix, from userid 500) id 6743A122E64; Mon, 28 Nov 2005 10:22:39 -0200 (BRST) Date: Mon, 28 Nov 2005 10:22:39 -0200 From: Marcelo Tosatti To: Andre Hedrick , Bartlomiej Zolnierkiewicz , Chris Ross Cc: Alan Cox , linux-kernel@vger.kernel.org Subject: [2.4 PATCH] Don't panic on IDE DMA errors Message-ID: <20051128122239.GB24608@logos.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1i X-Virus-Scanned: ClamAV version 0.85, clamav-milter version 0.85 on localhost X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org Status: RO Content-Length: 1462 Lines: 43 diff-tree e8f3e8dd41308fb66c026f51bb86b23205ad48c1 (from 0b85d6aa75faefe28d90362424035ef7b349974c) Author: Chris Ross 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/