# BUG: workqueue leaked lock or atomic: --help?

## rishi

I'm getting some weird kernel bug messages since upgrading to 2.6.20. I get this with either linux-2.6.20-gentoo-r7 or linux-2.6.20-gentoo-r8. 

```
~ # uname -a

Linux rishi-alien 2.6.20-gentoo-r8 #1 SMP PREEMPT Fri May 25 20:38:25 EST 2007 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux
```

I'm getting dmesg filling up with reams and reams of this:

```
BUG: workqueue leaked lock or atomic: ntos_wq/0x00000001/4289

    last function: kdpc_worker+0x0/0xf3 [ndiswrapper]

 [<c0103b07>] show_trace_log_lvl+0x1a/0x30

 [<c0103b2f>] show_trace+0x12/0x14

 [<c0103c29>] dump_stack+0x16/0x18

 [<c012dd83>] run_workqueue+0x145/0x14e

 [<c012decc>] worker_thread+0x140/0x15f

 [<c013129f>] kthread+0x97/0xc4

 [<c010398b>] kernel_thread_helper+0x7/0x10

 =======================

BUG: scheduling while atomic: ntos_wq/0x00000001/4289

 [<c0103b07>] show_trace_log_lvl+0x1a/0x30

 [<c0103b2f>] show_trace+0x12/0x14

 [<c0103c29>] dump_stack+0x16/0x18

 [<c03e353e>] __sched_text_start+0x5be/0x78e

 [<c012deb6>] worker_thread+0x12a/0x15f

 [<c013129f>] kthread+0x97/0xc4

 [<c010398b>] kernel_thread_helper+0x7/0x10

 =======================
```

It seems to be related to ndiswrapper, which I use for my wireless:

```
~ # lspci | grep Wireless

0a:05.0 Ethernet controller: Linksys, A Division of Cisco Systems [AirConn] INPROCOMM IPN 2220 Wireless LAN Adapter (rev 01)
```

The wireless seems to be working alright and associating with my access point OK using wpa_supplicant:

```
~ # iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

eth1      no wireless extensions.

wlan0     IEEE 802.11g  ESSID:"MyNetwork"

          Mode:Managed  Frequency:2.447 GHz  Access Point: 00:13:D3:68:94:E3

          Bit Rate=54 Mb/s

          RTS thr=2347 B   Fragment thr=-1 B

          Encryption key:off

          Power Management:off

          Link Quality:62/100  Signal level:-56 dBm  Noise level:-96 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
```

What is worse is if I run:

```
~ # /etc/init.d/net.wlan0 restart
```

I get a full hardware reset / POWER OFF!!!!!!!!!!!!!!!!!!!!!!!!     :Confused: 

Any help appreciated. 

Just in case it is relevant, here is my:

```
emerge --info

>>> cfg-update-1.8.2-r1: Checksum index is up-to-date ...

Portage 2.1.2.7 (default-linux/x86/2006.1/desktop, gcc-3.4.5, glibc-2.5-r2, 2.6.20-gentoo-r8 i686)

=================================================================

System uname: 2.6.20-gentoo-r8 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz

Gentoo Base System release 1.12.10

Timestamp of tree: Mon, 28 May 2007 03:50:01 +0000

distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]

ccache version 2.4 [enabled]

dev-java/java-config: 1.3.7, 2.0.31-r5

dev-lang/python:     2.4.4-r4

dev-python/pycrypto: 2.0.1-r5

dev-util/ccache:     2.4-r7

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.61

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.16.1-r3

sys-devel/gcc-config: 1.3.16

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.17-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -pipe -march=pentium4"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/grass60/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config /var/bind"

CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf /etc/java-config/vms/ /etc/revdep-rebuild /etc/splash /etc/terminfo"

CXXFLAGS="-O2 -pipe -march=pentium4"

DISTDIR="/usr/portage/distfiles"

FEATURES="ccache distlocks fixpackages metadata-transfer parallel-fetch sandbox sfperms strict"

GENTOO_MIRRORS="http://ftp.gentoo.or.kr/"

LINGUAS="en_GB"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/portage/local/layman/gentoo-gis"

SYNC="rsync://rsync.au.gentoo.org/gentoo-portage"

USE="X acpi alsa arts berkdb bitmap-fonts bzip2 cairo cdr cli cracklib crypt cups dbus dri dvd dvdr eds emboss encode esd fam firefox fortran gdbm gif gnome gpm gstreamer gtk hal iconv ipv6 irmc isdnlog java jpeg kde kdepim ldap libg++ mad midi mikmod mozilla mp3 mpeg mudflap ncurses nls nptl nptlonly nvidia ogg opengl openmp oss pam pcre pda perl png ppds pppd python qt qt3 qt4 quicktime readline reflection samba sdl session spell spl ssl tcpd truetype truetype-fonts type1-fonts unicode vorbis win32codecs x86 xml xorg xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" USERLAND="GNU" VIDEO_CARDS="nvidia fbdev vesa"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
```

----------

