This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Segmentation fault while using rmmod

Hi there,

Everytime I remove my module using rmmod <module name> I'm getting the error - 

rmmod spi2.ko
[ 90.830108] kernel BUG at mm/slab.c:497!
[ 90.834228] BUG: sleeping function called from invalid context at arch/arm/mm/fault.c:295
[ 90.842803] in_atomic(): 0, irqs_disabled(): 128, pid: 1544, name: rmmod
[ 90.849822] INFO: lockdep is turned off.
[ 90.853912] irq event stamp: 0
[ 90.857116] hardirqs last enabled at (0): [< (null)>] (null)
[ 90.863403] hardirqs last disabled at (0): [<c0070fe4>] copy_process.part.39+0xb84/0xe50
[ 90.871917] softirqs last enabled at (0): [<c0070fe4>] copy_process.part.39+0xb84/0xe50
[ 90.880401] softirqs last disabled at (0): [< (null)>] (null)
[ 90.886749] [<c004bafc>] (unwind_backtrace+0x0/0xe0) from [<c049b4f4>] (do_page_fault.part.4+0x8
c/0x294)
[ 90.896697] [<c049b4f4>] (do_page_fault.part.4+0x8c/0x294) from [<c049b748>] (do_page_fault+0x4c
/0x58)
[ 90.906463] [<c049b748>] (do_page_fault+0x4c/0x58) from [<c003c1f4>] (do_DataAbort+0x34/0x98)
[ 90.915405] [<c003c1f4>] (do_DataAbort+0x34/0x98) from [<c049986c>] (__dabt_svc+0x4c/0x60)
[ 90.924072] Exception stack(0xcd15fee8 to 0xcd15ff30)
[ 90.929382] fee0: 00000032 c0641a35 cd15ff24 00000000 bf04ba8c bf04b568
[ 90.937927] ff00: a0000013 00000081 c00461a8 cd15e000 00000000 00021008 c08e70e4 cd15ff30
[ 90.946502] ff20: c0049a54 c0049a58 20000093 ffffffff
[ 90.951812] [<c049986c>] (__dabt_svc+0x4c/0x60) from [<c0049a58>] (__bug+0x1c/0x28)
[ 90.959869] [<c0049a58>] (__bug+0x1c/0x28) from [<c00f5938>] (kfree+0xb0/0x120)
[ 90.967529] [<c00f5938>] (kfree+0xb0/0x120) from [<bf04b47c>] (spike_exit+0x58/0x8c [spi2])
[ 90.976318] [<bf04b47c>] (spike_exit+0x58/0x8c [spi2]) from [<c00a7ce4>] (sys_delete_module+0x1a
4/0x218)
[ 90.986267] [<c00a7ce4>] (sys_delete_module+0x1a4/0x218) from [<c0045fe0>] (ret_fast_syscall+0x0
/0x3c)
[ 90.996032] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 91.004516] pgd = cd328000
[ 91.007324] [00000000] *pgd=8ecbe031, *pte=00000000, *ppte=00000000
[ 91.013916] Internal error: Oops: 817 [#1]
[ 91.018218] last sysfs file: /sys/module/spi2/refcnt
[ 91.023406] Modules linked in: spi2(-) bufferclass_ti omaplfb pvrsrvkm
[ 91.030303] CPU: 0 Tainted: G W (2.6.37 #1)
[ 91.035858] PC is at __bug+0x1c/0x28
[ 91.039611] LR is at __bug+0x18/0x28
[ 91.043365] pc : [<c0049a58>] lr : [<c0049a54>] psr: 20000093
[ 91.043365] sp : cd15ff30 ip : c08e70e4 fp : 00021008
[ 91.055389] r10: 00000000 r9 : cd15e000 r8 : c00461a8
[ 91.060852] r7 : 00000081 r6 : a0000013 r5 : bf04b568 r4 : bf04ba8c
[ 91.067687] r3 : 00000000 r2 : cd15ff24 r1 : c0641a35 r0 : 00000032
[ 91.074523] Flags: nzCv IRQs off FIQs on Mode SVC_32 ISA ARM Segment user
[ 91.082092] Control: 10c5387d Table: 8d328019 DAC: 00000015
[ 91.088104] Process rmmod (pid: 1544, stack limit = 0xcd15e2f0)
[ 91.094329] Stack: (0xcd15ff30 to 0xcd160000)
[ 91.098876] ff20: c0e5d960 c00f5938 00000001 bf04ba8c
[ 91.107452] ff40: 00000000 00000800 00000081 bf04b47c bf04b914 c00a7ce4 00008000 32697073
[ 91.116027] ff60: 00000000 cd33f0c0 cd2626c0 c00461a8 00000001 cd2626c0 00000000 c00f70e4
[ 91.124603] ff80: 00000003 cd33f0c0 00000000 00000001 00021d20 00046100 00000001 00021d20
[ 91.133178] ffa0: be9f0dbc c0045fe0 00000001 00021d20 00021d50 00000800 00000000 00000000
[ 91.141754] ffc0: 00000001 00021d20 be9f0dbc 00000081 00021d20 00000000 00000800 00021008
[ 91.150329] ffe0: be9f0eaf be9f0b60 49e60968 49dee56c 20000010 00021d50 00000000 00000000
[ 91.158905] [<c0049a58>] (__bug+0x1c/0x28) from [<c00f5938>] (kfree+0xb0/0x120)
[ 91.166564] [<c00f5938>] (kfree+0xb0/0x120) from [<bf04b47c>] (spike_exit+0x58/0x8c [spi2])
[ 91.175354] [<bf04b47c>] (spike_exit+0x58/0x8c [spi2]) from [<c00a7ce4>] (sys_delete_module+0x1a
4/0x218)
[ 91.185272] [<c00a7ce4>] (sys_delete_module+0x1a4/0x218) from [<c0045fe0>] (ret_fast_syscall+0x0
/0x3c)
[ 91.195037] Code: e59f0010 e1a01003 eb11216c e3a03000 (e5833000)
[ 91.207702] ---[ end trace 1b75b31a2719ed1f ]---
Segmentation fault

i dont think I have any process that sleeps. Why is this happening?