Re: Badness in local_bh_enable at kernel/softirq.c:140 with inet_stream

linux-os (Dick Johnson)
2006-04-06T17:59:55Z

On Thu, 6 Apr 2006, jordi Vaquero wrote:

> Hello
>
> I'm trying to make a Linux Kernel module. My module has a network
> comunication with sockets, I use the functions like this skeleton,
>
> sd = sock_create(AF_INET,SOCK_STREAM,IPPROTO_TCP,&sock);
> if(sd<0){
> printk(KERN_ERR "Error\n");
> }else{
> sout.sin_family = AF_INET;
> err = inet_aton("172.16.151.1",&sout.sin_addr); //this
> function works well, I implemented it.
> sout.sin_port = htons(20000);
> sd = sock->ops->connect(sock,(struct sockaddr*)&sout,
> sizeof(sout),O_RDWR);
> if(sd<0){
> printk(KERN_ERR "Error \n");
> sock_release(sock);
> }else{
> USE SENDMSG and RECVMSG
> ...
> ...
> ...
> sock_release(sock);
> }
>
> My problem is that sometimes, at some point near the connect function, a
> warning is launched and dmesg shows this:
>
[SNIPPED... Crap]

This has become a FAQ...
If you need to do this INSIDE the kernel, you need to do it from
a kernel thread. Otherwise, your socket is indistinguishable
from somebody else's open file descriptor. A file descriptor needs
a CONTEXT! The kernel doesn't have a CONTEXT! You need a process
to have a context, either a kernel thread or a user-mode task.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.15.4 on an i686 machine (5589.42 BogoMips).
Warning : 98.36% of all statistics are fiction, book release in April.
_
\x1a\x04

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.