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 |
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); |
All times are GMT -5. The time now is 10:41 PM. |