aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/socket.c22
2 files changed, 13 insertions, 15 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ba997095f08f..8690f171c1ef 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1535,8 +1535,7 @@ static unsigned int packet_poll(struct file * file, struct socket *sock,
1535static void packet_mm_open(struct vm_area_struct *vma) 1535static void packet_mm_open(struct vm_area_struct *vma)
1536{ 1536{
1537 struct file *file = vma->vm_file; 1537 struct file *file = vma->vm_file;
1538 struct inode *inode = file->f_dentry->d_inode; 1538 struct socket * sock = file->private_data;
1539 struct socket * sock = SOCKET_I(inode);
1540 struct sock *sk = sock->sk; 1539 struct sock *sk = sock->sk;
1541 1540
1542 if (sk) 1541 if (sk)
@@ -1546,8 +1545,7 @@ static void packet_mm_open(struct vm_area_struct *vma)
1546static void packet_mm_close(struct vm_area_struct *vma) 1545static void packet_mm_close(struct vm_area_struct *vma)
1547{ 1546{
1548 struct file *file = vma->vm_file; 1547 struct file *file = vma->vm_file;
1549 struct inode *inode = file->f_dentry->d_inode; 1548 struct socket * sock = file->private_data;
1550 struct socket * sock = SOCKET_I(inode);
1551 struct sock *sk = sock->sk; 1549 struct sock *sk = sock->sk;
1552 1550
1553 if (sk) 1551 if (sk)
diff --git a/net/socket.c b/net/socket.c
index 94fe638b4d72..e1bd5d84d7bf 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -667,7 +667,7 @@ static ssize_t sock_aio_read(struct kiocb *iocb, char __user *ubuf,
667 } 667 }
668 iocb->private = x; 668 iocb->private = x;
669 x->kiocb = iocb; 669 x->kiocb = iocb;
670 sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode); 670 sock = iocb->ki_filp->private_data;
671 671
672 x->async_msg.msg_name = NULL; 672 x->async_msg.msg_name = NULL;
673 x->async_msg.msg_namelen = 0; 673 x->async_msg.msg_namelen = 0;
@@ -709,7 +709,7 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf,
709 } 709 }
710 iocb->private = x; 710 iocb->private = x;
711 x->kiocb = iocb; 711 x->kiocb = iocb;
712 sock = SOCKET_I(iocb->ki_filp->f_dentry->d_inode); 712 sock = iocb->ki_filp->private_data;
713 713
714 x->async_msg.msg_name = NULL; 714 x->async_msg.msg_name = NULL;
715 x->async_msg.msg_namelen = 0; 715 x->async_msg.msg_namelen = 0;
@@ -732,7 +732,7 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
732 struct socket *sock; 732 struct socket *sock;
733 int flags; 733 int flags;
734 734
735 sock = SOCKET_I(file->f_dentry->d_inode); 735 sock = file->private_data;
736 736
737 flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT; 737 flags = !(file->f_flags & O_NONBLOCK) ? 0 : MSG_DONTWAIT;
738 if (more) 738 if (more)
@@ -741,14 +741,14 @@ static ssize_t sock_sendpage(struct file *file, struct page *page,
741 return sock->ops->sendpage(sock, page, offset, size, flags); 741 return sock->ops->sendpage(sock, page, offset, size, flags);
742} 742}
743 743
744static int sock_readv_writev(int type, struct inode * inode, 744static int sock_readv_writev(int type,
745 struct file * file, const struct iovec * iov, 745 struct file * file, const struct iovec * iov,
746 long count, size_t size) 746 long count, size_t size)
747{ 747{
748 struct msghdr msg; 748 struct msghdr msg;
749 struct socket *sock; 749 struct socket *sock;
750 750
751 sock = SOCKET_I(inode); 751 sock = file->private_data;
752 752
753 msg.msg_name = NULL; 753 msg.msg_name = NULL;
754 msg.msg_namelen = 0; 754 msg.msg_namelen = 0;
@@ -775,7 +775,7 @@ static ssize_t sock_readv(struct file *file, const struct iovec *vector,
775 int i; 775 int i;
776 for (i = 0 ; i < count ; i++) 776 for (i = 0 ; i < count ; i++)
777 tot_len += vector[i].iov_len; 777 tot_len += vector[i].iov_len;
778 return sock_readv_writev(VERIFY_WRITE, file->f_dentry->d_inode, 778 return sock_readv_writev(VERIFY_WRITE,
779 file, vector, count, tot_len); 779 file, vector, count, tot_len);
780} 780}
781 781
@@ -786,7 +786,7 @@ static ssize_t sock_writev(struct file *file, const struct iovec *vector,
786 int i; 786 int i;
787 for (i = 0 ; i < count ; i++) 787 for (i = 0 ; i < count ; i++)
788 tot_len += vector[i].iov_len; 788 tot_len += vector[i].iov_len;
789 return sock_readv_writev(VERIFY_READ, file->f_dentry->d_inode, 789 return sock_readv_writev(VERIFY_READ,
790 file, vector, count, tot_len); 790 file, vector, count, tot_len);
791} 791}
792 792
@@ -840,7 +840,7 @@ static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg)
840 void __user *argp = (void __user *)arg; 840 void __user *argp = (void __user *)arg;
841 int pid, err; 841 int pid, err;
842 842
843 sock = SOCKET_I(file->f_dentry->d_inode); 843 sock = file->private_data;
844 if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) { 844 if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) {
845 err = dev_ioctl(cmd, argp); 845 err = dev_ioctl(cmd, argp);
846 } else 846 } else
@@ -939,13 +939,13 @@ static unsigned int sock_poll(struct file *file, poll_table * wait)
939 /* 939 /*
940 * We can't return errors to poll, so it's either yes or no. 940 * We can't return errors to poll, so it's either yes or no.
941 */ 941 */
942 sock = SOCKET_I(file->f_dentry->d_inode); 942 sock = file->private_data;
943 return sock->ops->poll(file, sock, wait); 943 return sock->ops->poll(file, sock, wait);
944} 944}
945 945
946static int sock_mmap(struct file * file, struct vm_area_struct * vma) 946static int sock_mmap(struct file * file, struct vm_area_struct * vma)
947{ 947{
948 struct socket *sock = SOCKET_I(file->f_dentry->d_inode); 948 struct socket *sock = file->private_data;
949 949
950 return sock->ops->mmap(file, sock, vma); 950 return sock->ops->mmap(file, sock, vma);
951} 951}
@@ -995,7 +995,7 @@ static int sock_fasync(int fd, struct file *filp, int on)
995 return -ENOMEM; 995 return -ENOMEM;
996 } 996 }
997 997
998 sock = SOCKET_I(filp->f_dentry->d_inode); 998 sock = filp->private_data;
999 999
1000 if ((sk=sock->sk) == NULL) { 1000 if ((sk=sock->sk) == NULL) {
1001 kfree(fna); 1001 kfree(fna);