title: How to get the owner process of a socket?
body: <p>Given a socket struct, is there any way that I can get the owner process of this socket in a kernel module? That is, given a socket structure, I am trying to get the process descriptor (task_struct struct) of its owner process? </p>
  
  <p>My original idea is to traverse the tasklist. For each process p traversed, just check whether p's open file descriptors contains one that is the same as the file descriptor associated with the socket struct. (In struct socket, there is a field struct file *file).</p>
  
  <p>I am not sure whether the kernel allows me to traverse the tasklist or not. Anyone has some idea of how to do this? Thanks.</p>