Hi,
When I write a netfilter module, I got the following messages int /var/log/messages.
Apr 15 21:19:38 localhost kernel: Debug: sleeping function called from invalid c ontext at mm/slab.c:2082
Apr 15 21:19:38 localhost kernel: in_atomic():1, irqs_disabled():0
Apr 15 21:19:38 localhost kernel: [<c0104157>] dump_stack+0x17/0x20
Apr 15 21:19:38 localhost kernel: [<c011e5c4>] __might_sleep+0xa4/0xc0
Apr 15 21:19:38 localhost kernel: [<c015a753>] kmem_cache_alloc+0x53/0x70
Apr 15 21:19:38 localhost kernel: [<c016e020>] __get_vm_area+0x40/0x210
Apr 15 21:19:38 localhost kernel: [<c016e21a>] get_vm_area+0x2a/0x30
Apr 15 21:19:38 localhost kernel: [<c016e476>] __vmalloc+0x46/0x170
Apr 15 21:19:38 localhost kernel: [<c016e5b3>] vmalloc+0x13/0x20
Apr 15 21:19:38 localhost kernel: [<d09e709b>] create_dd+0x1b/0xb0 [tcp_credit]
Apr 15 21:19:38 localhost kernel: [<d09e7789>] credit_count+0xb9/0x180 [tcp_cre dit]
Apr 15 21:19:38 localhost kernel: [<c033388e>] nf_iterate+0x6e/0xc0
Apr 15 21:19:38 localhost kernel: [<c0333bdb>] nf_hook_slow+0x5b/0xe0
Apr 15 21:19:38 localhost kernel: [<c0349044>] ip_rcv+0x1b4/0x4a0
Apr 15 21:19:38 localhost kernel: [<c0328814>] netif_receive_skb+0x1f4/0x2b0
Apr 15 21:19:38 localhost kernel: [<c0328942>] process_backlog+0x72/0x100
Apr 15 21:19:38 localhost kernel: [<c0328a3d>] net_rx_action+0x6d/0x100
Apr 15 21:19:38 localhost kernel: [<c0129012>] __do_softirq+0x42/0xa0
Apr 15 21:19:38 localhost kernel: [<c0105891>] do_softirq+0x51/0x60
Apr 15 21:19:38 localhost kernel: =======================
Apr 15 21:19:38 localhost kernel: [<c01290e5>] local_bh_enable+0x75/0x80
Apr 15 21:19:38 localhost kernel: [<c0327d1a>] dev_queue_xmit+0x13a/0x5c0
Apr 15 21:19:38 localhost kernel: [<c032ea64>] neigh_resolve_output+0xc4/0x190
Apr 15 21:19:38 localhost kernel: [<c034c270>] ip_finish_output2+0xd0/0x1c0
Apr 15 21:19:38 localhost kernel: [<c0333c41>] nf_hook_slow+0xc1/0xe0
Apr 15 21:19:38 localhost kernel: [<c034bfaa>] ip_finish_output+0x5a/0x250
Apr 15 21:19:38 localhost kernel: [<c034c56a>] ip_output+0x4a/0x60
Apr 15 21:19:38 localhost kernel: [<c034bf2e>] dst_output+0xe/0x30
Apr 15 21:19:38 localhost kernel: [<c0333c41>] nf_hook_slow+0xc1/0xe0
Apr 15 21:19:38 localhost kernel: [<c034c7a5>] ip_queue_xmit+0x225/0x4a0
Apr 15 21:19:38 localhost kernel: [<c035d7f8>] tcp_transmit_skb+0x3a8/0x7a0
Apr 15 21:19:38 localhost kernel: [<c0360260>] tcp_connect+0x290/0x360
Apr 15 21:19:38 localhost kernel: [<c03635db>] tcp_v4_connect+0x48b/0xdc0
Apr 15 21:19:38 localhost kernel: [<c0374625>] inet_stream_connect+0x95/0x170
Apr 15 21:19:38 localhost kernel: [<c031dcfb>] sys_connect+0x8b/0x90
Apr 15 21:19:38 localhost kernel: [<c031e664>] sys_socketcall+0x94/0x260
Apr 15 21:19:39 localhost kernel: [<c0103a05>] sysenter_past_esp+0x52/0x75
This may be help.
# uname -a
Linux localhost.localdomain 2.6.11-kdb #5 Thu Apr 13 18:52:48 CST 2006 i686 athlon i386 GNU/Linux
In the module, I used the functions vmalloc / vfree . The system was down, while I freed a block of structure(struct) which was allocated by vmalloc. And I freed the structure in timer_out function.
code:
static void timeout_fn(unsigned long data)
{
struct sip_sport *pss=(struct sip_sport *)data;
struct dip_dport *pdd=pss->pdd;
del_ss(pss);
write_lock(&rwlock);//lock
destory_ss(pss);
write_unlock(&rwlock);//unlock
}
When I write a netfilter module, I got the following messages int /var/log/messages.
Apr 15 21:19:38 localhost kernel: Debug: sleeping function called from invalid c ontext at mm/slab.c:2082
Apr 15 21:19:38 localhost kernel: in_atomic():1, irqs_disabled():0
Apr 15 21:19:38 localhost kernel: [<c0104157>] dump_stack+0x17/0x20
Apr 15 21:19:38 localhost kernel: [<c011e5c4>] __might_sleep+0xa4/0xc0
Apr 15 21:19:38 localhost kernel: [<c015a753>] kmem_cache_alloc+0x53/0x70
Apr 15 21:19:38 localhost kernel: [<c016e020>] __get_vm_area+0x40/0x210
Apr 15 21:19:38 localhost kernel: [<c016e21a>] get_vm_area+0x2a/0x30
Apr 15 21:19:38 localhost kernel: [<c016e476>] __vmalloc+0x46/0x170
Apr 15 21:19:38 localhost kernel: [<c016e5b3>] vmalloc+0x13/0x20
Apr 15 21:19:38 localhost kernel: [<d09e709b>] create_dd+0x1b/0xb0 [tcp_credit]
Apr 15 21:19:38 localhost kernel: [<d09e7789>] credit_count+0xb9/0x180 [tcp_cre dit]
Apr 15 21:19:38 localhost kernel: [<c033388e>] nf_iterate+0x6e/0xc0
Apr 15 21:19:38 localhost kernel: [<c0333bdb>] nf_hook_slow+0x5b/0xe0
Apr 15 21:19:38 localhost kernel: [<c0349044>] ip_rcv+0x1b4/0x4a0
Apr 15 21:19:38 localhost kernel: [<c0328814>] netif_receive_skb+0x1f4/0x2b0
Apr 15 21:19:38 localhost kernel: [<c0328942>] process_backlog+0x72/0x100
Apr 15 21:19:38 localhost kernel: [<c0328a3d>] net_rx_action+0x6d/0x100
Apr 15 21:19:38 localhost kernel: [<c0129012>] __do_softirq+0x42/0xa0
Apr 15 21:19:38 localhost kernel: [<c0105891>] do_softirq+0x51/0x60
Apr 15 21:19:38 localhost kernel: =======================
Apr 15 21:19:38 localhost kernel: [<c01290e5>] local_bh_enable+0x75/0x80
Apr 15 21:19:38 localhost kernel: [<c0327d1a>] dev_queue_xmit+0x13a/0x5c0
Apr 15 21:19:38 localhost kernel: [<c032ea64>] neigh_resolve_output+0xc4/0x190
Apr 15 21:19:38 localhost kernel: [<c034c270>] ip_finish_output2+0xd0/0x1c0
Apr 15 21:19:38 localhost kernel: [<c0333c41>] nf_hook_slow+0xc1/0xe0
Apr 15 21:19:38 localhost kernel: [<c034bfaa>] ip_finish_output+0x5a/0x250
Apr 15 21:19:38 localhost kernel: [<c034c56a>] ip_output+0x4a/0x60
Apr 15 21:19:38 localhost kernel: [<c034bf2e>] dst_output+0xe/0x30
Apr 15 21:19:38 localhost kernel: [<c0333c41>] nf_hook_slow+0xc1/0xe0
Apr 15 21:19:38 localhost kernel: [<c034c7a5>] ip_queue_xmit+0x225/0x4a0
Apr 15 21:19:38 localhost kernel: [<c035d7f8>] tcp_transmit_skb+0x3a8/0x7a0
Apr 15 21:19:38 localhost kernel: [<c0360260>] tcp_connect+0x290/0x360
Apr 15 21:19:38 localhost kernel: [<c03635db>] tcp_v4_connect+0x48b/0xdc0
Apr 15 21:19:38 localhost kernel: [<c0374625>] inet_stream_connect+0x95/0x170
Apr 15 21:19:38 localhost kernel: [<c031dcfb>] sys_connect+0x8b/0x90
Apr 15 21:19:38 localhost kernel: [<c031e664>] sys_socketcall+0x94/0x260
Apr 15 21:19:39 localhost kernel: [<c0103a05>] sysenter_past_esp+0x52/0x75
This may be help.
# uname -a
Linux localhost.localdomain 2.6.11-kdb #5 Thu Apr 13 18:52:48 CST 2006 i686 athlon i386 GNU/Linux
In the module, I used the functions vmalloc / vfree . The system was down, while I freed a block of structure(struct) which was allocated by vmalloc. And I freed the structure in timer_out function.
code:
static void timeout_fn(unsigned long data)
{
struct sip_sport *pss=(struct sip_sport *)data;
struct dip_dport *pdd=pss->pdd;
del_ss(pss);
write_lock(&rwlock);//lock
destory_ss(pss);
write_unlock(&rwlock);//unlock
}