summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 6f2a17881972..5f76ab8a1594 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -404,6 +404,7 @@ int sock_map_fd(struct socket *sock)
file->f_mode = FMODE_READ | FMODE_WRITE;
file->f_flags = O_RDWR;
file->f_pos = 0;
+ file->private_data = sock;
fd_install(fd, file);
}
@@ -436,6 +437,9 @@ struct socket *sockfd_lookup(int fd, int *err)
return NULL;
}
+ if (file->f_op == &socket_file_ops)
+ return file->private_data; /* set in sock_map_fd */
+
inode = file->f_dentry->d_inode;
if (!S_ISSOCK(inode->i_mode)) {
*err = -ENOTSOCK;
OpenPOWER on IntegriCloud