Working with user space file descriptor in kernel thread

Peter Skvarka <[email protected]>
Newsgroups gmane.os.netbsd.devel.kernel
Organization Soft in Engines
Message-ID <[email protected]>
Hello,
I have created two sockets with socketpair() and one of them is put into 
kernel module through ioctl.
I need to work with passed socket in separate kernel thread.
In my module ioctl handler I am able to retrieve file descriptor from 
user mode descriptor (int user_sock) :
file_fd = fd_getfile2(lewepe->l_proc, user_sock);
and consequently pointer to socket structure:
struct socket* so = file_fd->f_undata.fd_so;

My question is:
Can I use such retrieved file_fd or struct socket* so in separate kernel 
thread ?

(Is not needed to call some kernel equivalent of dup() to duplicate 
retrieved file_fd or retrieved so to be able work in separate kernel 
thread ? Or to use copyin() on struct socket* to retrieve kernel copy of 
struct socket* ?
Or something other ?)

Peter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.