Hisax driver oopses when CONFIG_DEBUG_SHIRQ is enabled

Previous thread: Few ideas... by Krzysztof Halasa on Friday, February 29, 2008 - 3:48 pm. (5 messages)

Next thread: Re: [PATCH] CodingStyle: multiple updates by Bodo Eggert on Friday, February 29, 2008 - 5:10 pm. (2 messages)
From: Chuck Ebbert
Date: Friday, February 29, 2008 - 4:37 pm

From https://bugzilla.redhat.com/show_bug.cgi?id=362621

The driver enables interrupts before it is ready to receive them.

In drivers/isdn/hisax/hisax_fcpcipnp.c, adapter->read_hdlc etc. are
not initialized and the driver attempts to call these functions.

Nov 18 14:54:02 studienpraefekt kernel: hisax_fcpcipnp: found adapter Fritz!Card PCI v2 at 0000:00:0a.0
Nov 18 14:54:02 studienpraefekt kernel: Unable to handle kernel NULL pointer dereference at 0000000000000000 RIP:
Nov 18 14:54:02 studienpraefekt kernel:  [<0000000000000000>]
Nov 18 14:54:02 studienpraefekt kernel: PGD 240ee067 PUD 3effd067 PMD 0
Nov 18 14:54:02 studienpraefekt kernel: Oops: 0010 [1] SMP
Nov 18 14:54:02 studienpraefekt kernel: CPU 0
Nov 18 14:54:02 studienpraefekt kernel: Modules linked in: hisax_fcpcipnp hisax_isac hisax crc_ccitt isdn slhc rfcomm l2cap bluetooth autofs4 nls_utf8 cifs sunrpc nf_conntrack_netbios_ns nf_conntrack_ipv4 xt_state nf_conntrack nfnetlink ipt_REJECT iptable_filter ip_tables xt_tcpudp ip6t_REJECT ip6table_filter ip6_tables x_tables cpufreq_ondemand dm_multipath ipv6 snd_intel8x0 snd_ac97_codec ac97_bus snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss nvidia(P)(U) snd_pcm parport_pc parport snd_timer snd button soundcore k8temp i2c_core floppy hwmon snd_page_alloc pcspkr r8169 usblp sr_mod sg cdrom usb_storage dm_snapshot dm_zero dm_mirror dm_mod sata_sis pata_sis ata_generic libata sd_mod scsi_mod ext3 jbd mbcache uhci_hcd ohci_hcd ehci_hcd
Nov 18 14:54:02 studienpraefekt kernel: Pid: 26799, comm: modprobe Tainted: P        2.6.23.1-49.fc8 #1
Nov 18 14:54:02 studienpraefekt kernel: RIP: 0010:[<0000000000000000>]  [<0000000000000000>]
Nov 18 14:54:02 studienpraefekt kernel: RSP: 0018:ffff810010341c50  EFLAGS: 00010046
Nov 18 14:54:02 studienpraefekt kernel: RAX: 0000000000000000 RBX: ffff810008758270 RCX: ffffffff8106a940
Nov 18 14:54:02 studienpraefekt kernel: RDX: 0000000000001c02 RSI: 0000000000000000 RDI: ffff810008758000
Nov 18 14:54:02 ...
From: Kyle McMartin
Date: Saturday, March 1, 2008 - 9:26 am

After a quick glance at the code, we're getting the DEBUG_SHIRQ spurious
interrupt before we have the adapter template filled in. Real interrupts
appear to be turned on by fcpci*_init(), so move request_irq until just
before that.

Signed-off-by: Kyle McMartin <kmcmartin@redhat.com>

---
diff --git a/drivers/isdn/hisax/hisax_fcpcipnp.c b/drivers/isdn/hisax/hisax_fcpcipnp.c
index 7993e01..76043de 100644
--- a/drivers/isdn/hisax/hisax_fcpcipnp.c
+++ b/drivers/isdn/hisax/hisax_fcpcipnp.c
@@ -725,23 +725,6 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
 
 	switch (adapter->type) {
 	case AVM_FRITZ_PCIV2:
-		retval = request_irq(adapter->irq, fcpci2_irq, IRQF_SHARED,
-				     "fcpcipnp", adapter);
-		break;
-	case AVM_FRITZ_PCI:
-		retval = request_irq(adapter->irq, fcpci_irq, IRQF_SHARED,
-				     "fcpcipnp", adapter);
-		break;
-	case AVM_FRITZ_PNP:
-		retval = request_irq(adapter->irq, fcpci_irq, 0,
-				     "fcpcipnp", adapter);
-		break;
-	}
-	if (retval)
-		goto err_region;
-
-	switch (adapter->type) {
-	case AVM_FRITZ_PCIV2:
 	case AVM_FRITZ_PCI:
 		val = inl(adapter->io);
 		break;
@@ -796,6 +779,23 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
 
 	switch (adapter->type) {
 	case AVM_FRITZ_PCIV2:
+		retval = request_irq(adapter->irq, fcpci2_irq, IRQF_SHARED,
+				     "fcpcipnp", adapter);
+		break;
+	case AVM_FRITZ_PCI:
+		retval = request_irq(adapter->irq, fcpci_irq, IRQF_SHARED,
+				     "fcpcipnp", adapter);
+		break;
+	case AVM_FRITZ_PNP:
+		retval = request_irq(adapter->irq, fcpci_irq, 0,
+				     "fcpcipnp", adapter);
+		break;
+	}
+	if (retval)
+		goto err_region;
+
+	switch (adapter->type) {
+	case AVM_FRITZ_PCIV2:
 		fcpci2_init(adapter);
 		isacsx_setup(&adapter->isac);
 		break;
--

Previous thread: Few ideas... by Krzysztof Halasa on Friday, February 29, 2008 - 3:48 pm. (5 messages)

Next thread: Re: [PATCH] CodingStyle: multiple updates by Bodo Eggert on Friday, February 29, 2008 - 5:10 pm. (2 messages)