lkml.org 
[lkml]   [2002]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Linux 2.5.44-ac1
From
Date
On Tue, 2002-10-22 at 13:27, Alan Cox wrote:
> ** I strongly recommend saying N to IDE TCQ options otherwise this
> should hopefully build and run happily.

I don't have the IDE TCQ options on and am still having an issue with a
kernel oops in the default kernel code. I did some digging after I
noticed it in 2.5.43 and found a possibility for a null pointer in the
code within the ide_iomio_dma function in ide-dma.c The problem shows
itself if you only enable the secondary channel of your IDE controller.
I understand this is a strange set up, but it could happen in a machine
that boots off of SCSI and uses IDE disks for DATA or a CD Burner. I
came up with a fix, some extra sanity checks before this line in the
code:

hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;

Because it is the hwif->mate variable that is null when it gets here and
if hwif->channel is not 0 I am taking it from the logic on this line
that hwif->mate should not be a null variable. So I applied the sainity
checks in the attached patch and this seems to work. I did this against
the 2.5.43 and 2.5.44 kernels, and have posted patches for each of them
but no one seems interested. If I am completely off base here, just let
me know and I'll go back to the code and look for a different way to
conquer this little bug.

Jason




diff -u -r linux-2.5.44-vanilla/drivers/ide/ide-dma.c linux-2.5.44/drivers/ide/ide-dma.c
--- linux-2.5.44-vanilla/drivers/ide/ide-dma.c 2002-10-21 08:02:49.000000000 -0500
+++ linux-2.5.44/drivers/ide/ide-dma.c 2002-10-21 08:56:49.000000000 -0500
@@ -905,7 +905,12 @@
request_region(base+16, hwif->cds->extra, hwif->cds->name);
hwif->dma_extra = hwif->cds->extra;
}
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
+ if(!hwif->mate && hwif->channel){
+ hwif->dma_master=base;
+ }
+ else{
+ hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
+ }
if (hwif->dma_base2) {
if (!check_mem_region(hwif->dma_base2, ports))
request_mem_region(hwif->dma_base2, ports, hwif->name);
@@ -925,8 +930,13 @@
if ((hwif->cds->extra) && (hwif->channel == 0)) {
request_region(base+16, hwif->cds->extra, hwif->cds->name);
hwif->dma_extra = hwif->cds->extra;
+ }
+ if(!hwif->mate && hwif->channel){
+ hwif->dma_master=base;
+ }
+ else{
+ hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
}
- hwif->dma_master = (hwif->channel) ? hwif->mate->dma_base : base;
if (hwif->dma_base2) {
if (!request_region(hwif->dma_base2, ports, hwif->name))
{
\
 
 \ /
  Last update: 2005-03-22 13:30    [W:0.323 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site