Comment 30 for bug 356768

shamwow (sh4m-w0w) wrote :

Okay, so I think this worked. No crash yet. See my above post for problem/system description.

1) I downloaded linux sources for my kernel version using package manager, untarred them (2.6.31-20).

2) I manually applied Bob's patch by changing the relevant code in the relevant directory (using vi), specifically in these three files , which according to Bob Copeland need sanity checks added to prevent kernel panic.
/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k/base.c
/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k/base.h
/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k/phy.c

View the patch details here
http://bugzilla.kernel.org/attachment.cgi?id=19574

3) I recompiled the kernel. This took forever. I did 'make oldconfig' from the linux-source-2.6.31 directory, then did a 'make' and let it run while I slept.

4) To my surprise I found a nicely compiled ath5k.ko file!! I couldn't insmod it, so I backed up the old ath5k.ko module in /lib/modules/2.6.31-20..
/lib/modules/2.6.31-20-generic/kernel/drivers/net/wireless/ath/ath5k/ath5k.ko <-- needs to be backed up.

then I did this.

root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# modprobe -r ath5k
#wireless goes down
root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# ls
ath5k.h attach.o caps.o dma.c gpio.o Makefile phy.o rfbuffer.h
ath5k.ko base.c debug.c dma.o initvals.c Makefile.bak qcu.c rfgain.h
ath5k.mod.c base.h debug.h eeprom.c initvals.o modules.order qcu.o rfkill.c
ath5k.mod.o base.o desc.c eeprom.h Kconfig pcu.c reg.h rfkill.o
ath5k.o built-in.o desc.h eeprom.o led.c pcu.o reset.c
attach.c caps.c desc.o gpio.c led.o phy.c reset.o
root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# cp ath5k.ko /lib/modules/2.6.31-20-generic/kernel/drivers/net/wireless/ath/ath5k/
root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# depmod -a
root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# modprobe ath5k
root@failwhale-desktop:/usr/src/linux-source-2.6.31/drivers/net/wireless/ath/ath5k# uname -a
Linux failwhale-desktop 2.6.31-20-generic #57-Ubuntu SMP Mon Feb 8 09:05:19 UTC 2010 i686 GNU/Linux
#wireless comes back up

Hopefully we are stable now, if you don't see any more posts here you can assume my manual application of Bob Copeland's ath5k driver fix is effective... you can look at the patch file here, it's like 10 lines of ath5k code to add a couple of locks and sanity checks during the wireless interface reset...
http://bugzilla.kernel.org/attachment.cgi?id=19574