I want to open a UDP socket on user space using socket() function

Then I want to send packets over that socket from kernel module using sock_sendmsg() function.

But in kernel module, I dont know how to get/map pointer to "struct socket *sock" from the socket descriptor which is returned by socket() function.

I think sysfd_lookup() will get pointer to associated "struct socket *sock" from the fd, but it will work ONLY if the kernel module runs on behalf of that process.

Since my kernel module will not run on behalf that process, how to get the "struct socket *sock"

Please suggest.


Thanks
Sam