2003-06-21 11:19:51

by schmurtz

[permalink] [raw]
Subject: 2.5.72-bk3 oops when loading aha152X(isapnp)


Using 2.4 kernels, everything is ok.


SCSI subsystem initialized
pnp: Device 01:02.00 activated.
aha152x: found ISAPnP AVA-1505A at io=0x140, irq=10
aha152x: BIOS test: passed, detected 1 controller(s)
aha152x: resetting bus...
aha152x0: vital data: rev=3, io=0x140 (0x140/0x140), irq=10, scsiid=7, reconnecd
aha152x0: trying software interrupt, <1>Unable to handle kernel NULL pointer dec
printing eip:
c58a01ea
*pde = 00000000
Oops: 0000 [#1]
CPU: 0
EIP: 0060:[<c58a01ea>] Not tainted
EFLAGS: 00010046
EIP is at swintr+0x4a/0x70 [aha152x]
eax: 00000000 ebx: c4201340 ecx: 0000000a edx: 00000002
esi: 24000001 edi: 00000000 ebp: c3f75ecc esp: c3f75ec8
ds: 007b es: 007b ss: 0068
Process modprobe (pid: 240, threadinfo=c3f74000 task=c40cad00)
Stack: 0000000a c3f75eec c010a713 0000000a c4102800 c3f75f1c c3f74000 0000000a
c02c1f00 c3f75f14 c010aa49 0000000a c3f75f1c c4201340 c4201340 00000500
c4102800 c41029b0 00000140 c3f75f5c c0109288 c4102800 c4699280 00000152
Call Trace:
[<c010a713>] handle_IRQ_event+0x33/0x60
[<c010aa49>] do_IRQ+0xb9/0x180
[<c0109288>] common_interrupt+0x18/0x20
[<c58a6805>] +0x125/0x1304 [aha152x]
[<c58a045e>] aha152x_probe_one+0x24e/0x3d0 [aha152x]
[<c58a0060>] +0x60/0x80 [aha152x]
[<c58aa020>] setup+0x0/0x50 [aha152x]
[<c58a09ae>] aha152x_detect+0x3ce/0x810 [aha152x]
[<c58aa020>] setup+0x0/0x50 [aha152x]
[<c58a0df0>] aha152x_release+0x0/0x80 [aha152x]
[<c58a9900>] +0x0/0x200 [aha152x]
[<c582503c>] +0x3c/0xec [aha152x]
[<c58a9860>] aha152x_driver_template+0x0/0xa0 [aha152x]
[<c012c6ab>] sys_init_module+0xfb/0x210
[<c0109067>] syscall_call+0x7/0xb

Code: a1 4c 00 00 00 25 ff ff 00 00 50 68 e0 66 8a c5 e8 61 86 87
<0>Kernel panic: Fatal exception in interrupt
In interrupt handler - not syncing


--
S.


2003-06-21 14:14:48

by Martin Diehl

[permalink] [raw]
Subject: Re: 2.5.72-bk3 oops when loading aha152X(isapnp)

On Sat, 21 Jun 2003 [email protected] wrote:

> aha152x0: trying software interrupt, <1>Unable to handle kernel NULL pointer dec
...
> EIP is at swintr+0x4a/0x70 [aha152x]

Seems there are two problems:
* interrupt handler expects to find the host in aha152x_host[] array which
is currently set too late after probing irq's
* despite testing for NULL swintr derefences a shpnt==NULL anyway, looks
like a victim of HOSTNO obfuscation ;-)

The patch below fixes the issue for me - succesfully tested to compile,
load and even use my attached scanner.

Martin
----------------------

--- linux-2.5.72-bk3/drivers/scsi/aha152x.c Sat Jun 21 16:14:40 2003
+++ v2.5.72bk3-md/drivers/scsi/aha152x.c Sat Jun 21 16:07:05 2003
@@ -941,7 +941,8 @@ static irqreturn_t swintr(int irqno, voi
struct Scsi_Host *shpnt = lookup_irq(irqno);

if (!shpnt) {
- printk(KERN_ERR "aha152x%d: catched software interrupt %d for unknown controller.\n", HOSTNO, irqno);
+ /* no point using HOSTNO here! */
+ printk(KERN_ERR "aha152x: catched software interrupt %d for unknown controller.\n", irqno);
return IRQ_NONE;
}

@@ -1049,6 +1050,10 @@ struct Scsi_Host *aha152x_probe_one(stru

printk(KERN_INFO "aha152x%d: trying software interrupt, ",
shost->host_no);
+
+ /* need to have host registered before triggering any interrupt */
+ aha152x_host[registered_count] = shost;
+ mb();
SETPORT(DMACNTRL0, SWINT|INTEN);
mdelay(1000);
free_irq(shost->irq, shost);
@@ -1064,7 +1069,7 @@ struct Scsi_Host *aha152x_probe_one(stru

printk(KERN_ERR "aha152x%d: IRQ %d possibly wrong. "
"Please verify.\n", shost->host_no, shost->irq);
- goto out_release_region;
+ goto out_unregister_host;
}
printk("ok.\n");

@@ -1077,12 +1082,12 @@ struct Scsi_Host *aha152x_probe_one(stru
"aha152x", shost) < 0) {
printk(KERN_ERR "aha152x%d: failed to reassign interrupt.\n",
shost->host_no);
- goto out_release_region;
+ goto out_unregister_host;
}
-
- aha152x_host[registered_count] = shost;
return shost; /* the pcmcia stub needs the return value; */

+out_unregister_host:
+ aha152x_host[registered_count] = NULL;
out_release_region:
release_region(shost->io_port, IO_RANGE);
out_unregister: