i am trying to run the linux kernel module in linux kernel. But what is happening, sometimes it succeeds and run, sometimes insertion of module fails with error :
insmod: ERROR: could not insert module netlinkKernel.ko: No child processes
and kernel logs shows it is failing at print
Error creating socket nl_sk
I think its a common error , and i do not think it has to do anything with module.
I am just creating two netlink sockets in module. when i comment the second socket creation line, With one netlink sockets, the module is working fine, but with two as pasted in code below, it alywas gives this error, then again, when i try the module with one netlink socket, then it also fails and i have to reboot the system.
static int __init hello_init(void) {
printk("Entering: %s\n",__FUNCTION__);
// This is for 3.6 kernels and above.
struct netlink_kernel_cfg cfg = {
.input = hello_nl_recv_msg,
};
struct netlink_kernel_cfg cfg1 = {
.input = hello_nl_recv_msg1,
};
nl_sk = netlink_kernel_create(&init_net, NETLINK_USER, &cfg);
nl_sk1 = netlink_kernel_create(&init_net, NETLINK_USER1, &cfg1);
//nl_sk = netlink_kernel_create(&init_net, NETLINK_USER, 0, hello_nl_recv_msg,NULL,THIS_MODULE);
if(!nl_sk)
{
printk(KERN_ALERT "Error creating socket nl_sk.\n");
return -10;
}
if(!nl_sk1)
{
printk(KERN_ALERT "Error creating socket nl_sk1.\n");
return -10;
}
return 0;
}
Can anyone please shed a light on this ?