Kernel crashes while calling sock->ops->connect()

From: Rahul Murmuria <hidden>
Date: 2009-05-03 23:37:36

Hi!
I have been writing a /net virtual filesystem for Linux Kernel[1].

Currently, I am just trying to wrap around BSD Socket in kernel-space.
That involves me using sock_create and sock->ops->connect. This
commit[2] shows pretty much everything that I am working with.

In the function int socknet_connect(), I am creating a socket and
connecting to the ip:port provided from a synthetic file. The problem
is with:
ret = sock->ops->connect(sock, (struct sockaddr *)&addr, sizeof(addr),
sock->file->f_flags);

If I comment the above line, all is fine, but as soon as I use this
function, the kernel crashes in run-time. i.e. in my case, when I say
echo "connect 92.243.0.230:80" > /net/tcp/0/ctl

I have checked ML Archives. Someone suggested checking if the char *ip
does not end in \n or \r. I have also checked for other
implementations in the kernel to see if I am setting the values for
"struct sockaddr_in addr" correctly. I put the sock_create and
ops->connect in the same function to try and avoid errors with struct
socket *sock not being passed around correctly. The problems still
prevail.
So far, no luck.

Can anyone suggest what other things could go wrong? Or maybe look
into my code if you would be kind enough!

[1] http://slashnet.wordpress.com/
[2] http://hg.glendix.org/glendix/rev/31c5adbe25aa


Best Regards,
-- 
Rahul Murmuria
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help