Discussion:
2.6.24 patch and usb kernel bug
Tormod Volden
17 years ago
Permalink
Hi,
The attached patch makes linux-wlan-ng compile on 2.6.24. However, as soon
as I plug in my USB card, I get the below kernel BUG message (tested on
Debian and Ubuntu). Does anyone have an idea how this can be fixed?

Best regards,
Tormod Volden


prism2usb_init: prism2_usb.o: 0.2.9 Loaded
prism2usb_init: dev_info is: prism2_usb
usbcore: registered new interface driver prism2_usb
usb 1-2: new full speed USB device using uhci_hcd and address 2
usb 1-2: configuration #1 chosen from 1 choice
------------[ cut here ]------------
kernel BUG at net/core/dev.c:852!
invalid opcode: 0000 [#1]
Modules linked in: prism2_usb p80211 savage drm ppdev lp ipv6 powernow_k7
cpufreq_userspace cpufreq_stats cpufreq_powersave cpufreq_ondemand
freq_table cpufreq_conservative loop snd_via82xx gameport snd_ac97_codec
ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm snd_page_alloc snd_mpu401_uart
pcmcia firmware_class snd_seq_dummy video output snd_seq_oss battery
snd_seq_midi snd_seq_midi_event ac evdev snd_seq button snd_timer
snd_rawmidi snd_seq_device via686a psmouse joydev via_agp i2c_viapro
i2c_core agpgart serio_raw snd yenta_socket rsrc_nonstatic shpchp parport_pc
parport pcmcia_core pci_hotplug soundcore rtc pcspkr ext3 jbd dm_mirror
dm_snapshot dm_mod ide_cd cdrom ide_disk 8139too ata_generic libata scsi_mod
floppy 8139cp mii uhci_hcd usbcore via82cxxx generic ide_core thermal
processor fan

Pid: 687, comm: khubd Not tainted (2.6.24-1-486 #1)
EIP: 0060:[<c025a276>] EFLAGS: 00010246 CPU: 0
EIP is at dev_alloc_name+0x12/0x3a
EAX: 00000000 EBX: c691e400 ECX: 00000000 EDX: cfb76383
ESI: c691e000 EDI: c691e000 EBP: ca5e1800 ESP: ce80dce8
DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
Process khubd (pid: 687, ti=ce80c000 task=ce43a610 task.ti=ce80c000)
Stack: c0127081 00000000 c0262616 c691e400 c691e400 cfc206d0 c691e000
cfb75424
c691e400 cfc206d0 c69ee000 cfc1f351 c69ec878 00000000 cf89401f
c69ee000
c691ec00 cfc279b4 ca5e1800 ca5e1800 cfc279b4 00000000 cfc26858
cf894a79
Call Trace:
[<c0127081>] queue_work+0x22/0x2b
[<c0262616>] linkwatch_schedule_work+0x46/0x7f
[<cfb75424>] register_wlandev+0x17/0xb3 [p80211]
[<cfc1f351>] prism2sta_probe_usb+0x15b/0x200 [prism2_usb]
[<cf89401f>] usb_autopm_do_device+0xc7/0xd1 [usbcore]
[<cf894a79>] usb_probe_interface+0xbf/0x102 [usbcore]
[<c0231fe3>] driver_probe_device+0xdd/0x15a
[<c02b3471>] klist_next+0x46/0x61
[<c0232060>] __device_attach+0x0/0x5
[<c02314bb>] bus_for_each_drv+0x39/0x60
[<c02320dd>] device_attach+0x5d/0x70
[<c0232060>] __device_attach+0x0/0x5
[<c0231435>] bus_attach_device+0x26/0x73
[<c0230696>] device_add+0x2ff/0x50c
[<cf89334e>] usb_set_configuration+0x41d/0x497 [usbcore]
[<cf899e33>] generic_probe+0x50/0x91 [usbcore]
[<cf894861>] usb_probe_device+0x32/0x37 [usbcore]
[<c0231fe3>] driver_probe_device+0xdd/0x15a
[<c02b3471>] klist_next+0x46/0x61
[<c0232060>] __device_attach+0x0/0x5
[<c02314bb>] bus_for_each_drv+0x39/0x60
[<c02320dd>] device_attach+0x5d/0x70
[<c0232060>] __device_attach+0x0/0x5
[<c0231435>] bus_attach_device+0x26/0x73
[<c0230696>] device_add+0x2ff/0x50c
[<cf88ec79>] usb_new_device+0x4b/0x88 [usbcore]
[<cf890215>] hub_thread+0x6c5/0xaa3 [usbcore]
[<c0117235>] update_curr+0x62/0xef
[<c0117235>] update_curr+0x62/0xef
[<c0102e7d>] __switch_to+0x7c/0xeb
[<c0129b90>] autoremove_wake_function+0x0/0x35
[<cf88fb50>] hub_thread+0x0/0xaa3 [usbcore]
[<c01299e1>] kthread+0x36/0x5d
[<c01299ab>] kthread+0x0/0x5d
[<c0104e07>] kernel_thread_helper+0x7/0x10
=======================
Code: ff 85 c0 74 10 89 5c 24 04 c7 04 24 77 da 2f c0 e8 1e c9 ec ff 5b 58
5b c3 57 56 89 c6 53 83 ec 10 8b 80 44 02 00 00 85 c0 75 04 <0f> 0b eb fe 89
e1 e8 06 e9 ff ff 85 c0 89 c3 78 0e b9 10 00 00
EIP: [<c025a276>] dev_alloc_name+0x12/0x3a SS:ESP 0068:ce80dce8
---[ end trace 092dd320d1b635df ]---
Tormod Volden
17 years ago
Permalink
I am sorry for the use of Gmail, which seems to add html text and
encode text attachments. Here is the patch in-line.
Tormod

Index: src/p80211/p80211netdev.c
===================================================================
--- src/p80211/p80211netdev.c (revision 1840)
+++ src/p80211/p80211netdev.c (working copy)
@@ -83,6 +83,10 @@
#include <net/iw_handler.h>
#endif

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
+#define proc_net init_net.proc_net
+#endif
+
/*================================================================*/
/* Project Includes */

Index: src/prism2/driver/prism2_plx.c
===================================================================
--- src/prism2/driver/prism2_plx.c (revision 1840)
+++ src/prism2/driver/prism2_plx.c (working copy)
@@ -228,7 +228,9 @@
/* Register the wlandev, this gets us a name and registers the
* linux netdevice.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
SET_MODULE_OWNER(wlandev->netdev);
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
SET_NETDEV_DEV(wlandev->netdev, &(pdev->dev));
#endif
Index: src/prism2/driver/prism2_cs.c
===================================================================
--- src/prism2/driver/prism2_cs.c (revision 1840)
+++ src/prism2/driver/prism2_cs.c (working copy)
@@ -517,7 +517,9 @@
#endif

/* Register the network device and get assigned a name */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
SET_MODULE_OWNER(wlandev->netdev);
+#endif
SET_NETDEV_DEV(wlandev->netdev, &handle_to_dev(pdev));
if (register_wlandev(wlandev) != 0) {
WLAN_LOG_NOTICE("prism2sta_cs: register_wlandev() failed.\n");
@@ -1080,7 +1082,9 @@
link->dev = &hw->node;

/* Register the network device and get assigned a name */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
SET_MODULE_OWNER(wlandev->netdev);
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) )
SET_NETDEV_DEV(wlandev->netdev, &handle_to_dev(link->handle));
#endif
Index: src/prism2/driver/prism2_usb.c
===================================================================
--- src/prism2/driver/prism2_usb.c (revision 1840)
+++ src/prism2/driver/prism2_usb.c (working copy)
@@ -132,7 +132,9 @@
/* Register the wlandev, this gets us a name and registers the
* linux netdevice.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
SET_MODULE_OWNER(wlandev->netdev);
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
SET_NETDEV_DEV(wlandev->netdev, &(interface->dev));
#endif
Index: src/prism2/driver/prism2_pci.c
===================================================================
--- src/prism2/driver/prism2_pci.c (revision 1840)
+++ src/prism2/driver/prism2_pci.c (working copy)
@@ -119,7 +119,9 @@
/* Register the wlandev, this gets us a name and registers the
* linux netdevice.
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
SET_MODULE_OWNER(wlandev->netdev);
+#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
SET_NETDEV_DEV(wlandev->netdev, &(pdev->dev));
#endif
Tormod Volden
17 years ago
Permalink
Inspired by http://readlist.com/lists/vger.kernel.org/linux-kernel/84/420310.html,
I added a "dev->nd_net = &init_net" to wlan_setup() and that made my
card work. I don't know really what I am doing, so I don't know if
it's the right place or if it should be ifdef'ed further. New patch
attached.
Karl Relton
17 years ago
Permalink
Post by Tormod Volden
Inspired by http://readlist.com/lists/vger.kernel.org/linux-kernel/84/420310.html,
I added a "dev->nd_net = &init_net" to wlan_setup() and that made my
card work. I don't know really what I am doing, so I don't know if
it's the right place or if it should be ifdef'ed further. New patch
attached.
The changes to wlan_setup() in p80211netdev.c seem good to me -
mimmicking what other network drivers do in 2.6.24.

The changes in the other files putting an ifdef around SET_MODULE_OWNER
is good - it looks like it was deprecated in the kernel and removed
altogether in 2.6.24.


Solomon: Good to commit to get this driver working with 2.6.24?

Karl
Solomon Peachy
17 years ago
Permalink
Post by Karl Relton
Solomon: Good to commit to get this driver working with 2.6.24?
The only reason I haven't applied the patch yet is that I don't have a
working 2.6.24 kernel to test against yet.

It looks good, though.

- Solomon
--
Solomon Peachy ***@linux-wlan.com
AbsoluteValue Systems http://www.linux-wlan.com
721-D North Drive +1 (321) 259-0737 (office)
Melbourne, FL 32934 +1 (321) 259-0286 (fax)
Tormod Volden
17 years ago
Permalink
Post by Solomon Peachy
Post by Karl Relton
Solomon: Good to commit to get this driver working with 2.6.24?
The only reason I haven't applied the patch yet is that I don't have a
working 2.6.24 kernel to test against yet.
It looks good, though.
Testing svn 1842: You forgot the nd_net/init_net (introduced in my
second patch) that avoids the oops.

Tormod

@@ -938,7 +943,11 @@
dev->wireless_handlers = &p80211wext_handler_def;
#endif
#endif
-
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) )
+ dev->nd_net = &init_net;
+#endif
+
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
dev->tbusy = 1;
dev->start = 0;
Solomon Peachy
17 years ago
Permalink
Post by Tormod Volden
Testing svn 1842: You forgot the nd_net/init_net (introduced in my
second patch) that avoids the oops.
So I did. And so it is now fixed.

This is what happens when I don't test things. :)

- Solomon
--
Solomon Peachy ***@linux-wlan.com
AbsoluteValue Systems http://www.linux-wlan.com
721-D North Drive +1 (321) 259-0737 (office)
Melbourne, FL 32934 +1 (321) 259-0286 (fax)
Tormod Volden
17 years ago
Permalink
I guess we can bump the kernel version warning now?

Tormod

--- Configure.orig 2008-02-01 23:03:18.000000000 +0100
+++ Configure 2008-02-01 23:07:43.000000000 +0100
@@ -277,9 +277,9 @@ if [ $VERSION_CODE -ge `version 2 6 17`
fi
write_bool KERN_2_6_17

-if [ $VERSION_CODE -gt `version 2 6 23` ] ; then
+if [ $VERSION_CODE -gt `version 2 6 24` ] ; then
$ECHO "******* WARNING WARNING WARNING *******"
- $ECHO "Kernels newer than 2.6.23.x are not supported."
+ $ECHO "Kernels newer than 2.6.24.x are not supported."
$ECHO "******* WARNING WARNING WARNING *******"
fi

Loading...