LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 06-25-2009, 04:33 PM   #1
ranthal
LQ Newbie
 
Registered: Jun 2009
Location: Carlsbad, CA
Posts: 24

Rep: Reputation: 15
Problem w/ rmmod from netlink sockets


Hey all,

I wrote a module that makes use of netlink sockets to talk to a user-space application among other things and I'm having some trouble getting rmmod to work once it is up. I believe it is caused by my implementation of the netlink sockets since rmmod works just fine when I don't launch the user-space application it talks to but it fails when I do. The reason it provides for the inability to rmmod is that the resource is temporarily unavailable. An lsmod shows that the module is used by 1 other process.

In my implementation I have tried to close the socket connection in the module's exit function by performing both netlink_kernel_release(nl_sock) and sock_release(nl_sock->socket). The first compiles fine and is what I have been testing and runs into the problem. The second is not compiling and the error the compiler gives me is that I'm dereferencing a pointer to an incomplete type.

Any suggestions?

One other possible source of the problem that has crossed my mind is earlier in testing after I unicasted a message I freed the corresponding skb which caused the kernel to try and access a NULL address which was clearly all bad. Am I supposed to keep track of this skb and free it at a later time?

Kernel 2.6.26.2

Thanks
 
Old 06-25-2009, 05:58 PM   #2
ranthal
LQ Newbie
 
Registered: Jun 2009
Location: Carlsbad, CA
Posts: 24

Original Poster
Rep: Reputation: 15
Just ran another quick test to see more about the relationship to the user-space process was-I brought up the two and established the link, killed the user-space process and then the module was free to rmmod.

Maybe there's some sort of netlink socket command I can use to disconnect before I release the socket?

Pseduo-code:
if(netlink_has_listeners(nl_sock))
{
//detach from listener
}
netlink_kernel_release(nl_sock);
 
  


Reply

Tags
kernel, modules, netlink


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic Netlink sockets krishna123 Linux - Networking 0 03-04-2009 01:30 AM
A question about netlink sockets alfrag Linux - Newbie 1 12-26-2008 08:48 AM
Kernel module using netlink sockets arunka Programming 1 03-31-2005 07:42 AM
Netlink Sockets Problem gio123 Programming 3 01-23-2005 06:17 PM
Adding Routes using Netlink Sockets mpls_linux Linux - Networking 0 05-22-2004 09:14 PM


All times are GMT -5. The time now is 06:36 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration