diff options
Diffstat (limited to 'arch/sparc64/solaris')
| -rw-r--r-- | arch/sparc64/solaris/ioctl.c | 15 | ||||
| -rw-r--r-- | arch/sparc64/solaris/timod.c | 29 |
2 files changed, 31 insertions, 13 deletions
diff --git a/arch/sparc64/solaris/ioctl.c b/arch/sparc64/solaris/ioctl.c index cac0a1cf0050..be0a054e3ed6 100644 --- a/arch/sparc64/solaris/ioctl.c +++ b/arch/sparc64/solaris/ioctl.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
| 25 | #include <linux/mtio.h> | 25 | #include <linux/mtio.h> |
| 26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
| 27 | #include <linux/rcupdate.h> | ||
| 27 | #include <linux/compat.h> | 28 | #include <linux/compat.h> |
| 28 | 29 | ||
| 29 | #include <net/sock.h> | 30 | #include <net/sock.h> |
| @@ -293,16 +294,18 @@ static struct module_info { | |||
| 293 | static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) | 294 | static inline int solaris_sockmod(unsigned int fd, unsigned int cmd, u32 arg) |
| 294 | { | 295 | { |
| 295 | struct inode *ino; | 296 | struct inode *ino; |
| 297 | struct fdtable *fdt; | ||
| 296 | /* I wonder which of these tests are superfluous... --patrik */ | 298 | /* I wonder which of these tests are superfluous... --patrik */ |
| 297 | spin_lock(¤t->files->file_lock); | 299 | rcu_read_lock(); |
| 298 | if (! current->files->fd[fd] || | 300 | fdt = files_fdtable(current->files); |
| 299 | ! current->files->fd[fd]->f_dentry || | 301 | if (! fdt->fd[fd] || |
| 300 | ! (ino = current->files->fd[fd]->f_dentry->d_inode) || | 302 | ! fdt->fd[fd]->f_dentry || |
| 303 | ! (ino = fdt->fd[fd]->f_dentry->d_inode) || | ||
| 301 | ! S_ISSOCK(ino->i_mode)) { | 304 | ! S_ISSOCK(ino->i_mode)) { |
| 302 | spin_unlock(¤t->files->file_lock); | 305 | rcu_read_unlock(); |
| 303 | return TBADF; | 306 | return TBADF; |
| 304 | } | 307 | } |
| 305 | spin_unlock(¤t->files->file_lock); | 308 | rcu_read_unlock(); |
| 306 | 309 | ||
| 307 | switch (cmd & 0xff) { | 310 | switch (cmd & 0xff) { |
| 308 | case 109: /* SI_SOCKPARAMS */ | 311 | case 109: /* SI_SOCKPARAMS */ |
diff --git a/arch/sparc64/solaris/timod.c b/arch/sparc64/solaris/timod.c index 022c80f43392..aaad29c35c83 100644 --- a/arch/sparc64/solaris/timod.c +++ b/arch/sparc64/solaris/timod.c | |||
| @@ -143,9 +143,11 @@ static struct T_primsg *timod_mkctl(int size) | |||
| 143 | static void timod_wake_socket(unsigned int fd) | 143 | static void timod_wake_socket(unsigned int fd) |
| 144 | { | 144 | { |
| 145 | struct socket *sock; | 145 | struct socket *sock; |
| 146 | struct fdtable *fdt; | ||
| 146 | 147 | ||
| 147 | SOLD("wakeing socket"); | 148 | SOLD("wakeing socket"); |
| 148 | sock = SOCKET_I(current->files->fd[fd]->f_dentry->d_inode); | 149 | fdt = files_fdtable(current->files); |
| 150 | sock = SOCKET_I(fdt->fd[fd]->f_dentry->d_inode); | ||
| 149 | wake_up_interruptible(&sock->wait); | 151 | wake_up_interruptible(&sock->wait); |
| 150 | read_lock(&sock->sk->sk_callback_lock); | 152 | read_lock(&sock->sk->sk_callback_lock); |
| 151 | if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) | 153 | if (sock->fasync_list && !test_bit(SOCK_ASYNC_WAITDATA, &sock->flags)) |
| @@ -157,9 +159,11 @@ static void timod_wake_socket(unsigned int fd) | |||
| 157 | static void timod_queue(unsigned int fd, struct T_primsg *it) | 159 | static void timod_queue(unsigned int fd, struct T_primsg *it) |
| 158 | { | 160 | { |
| 159 | struct sol_socket_struct *sock; | 161 | struct sol_socket_struct *sock; |
| 162 | struct fdtable *fdt; | ||
| 160 | 163 | ||
| 161 | SOLD("queuing primsg"); | 164 | SOLD("queuing primsg"); |
| 162 | sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; | 165 | fdt = files_fdtable(current->files); |
| 166 | sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; | ||
| 163 | it->next = sock->pfirst; | 167 | it->next = sock->pfirst; |
| 164 | sock->pfirst = it; | 168 | sock->pfirst = it; |
| 165 | if (!sock->plast) | 169 | if (!sock->plast) |
| @@ -171,9 +175,11 @@ static void timod_queue(unsigned int fd, struct T_primsg *it) | |||
| 171 | static void timod_queue_end(unsigned int fd, struct T_primsg *it) | 175 | static void timod_queue_end(unsigned int fd, struct T_primsg *it) |
| 172 | { | 176 | { |
| 173 | struct sol_socket_struct *sock; | 177 | struct sol_socket_struct *sock; |
| 178 | struct fdtable *fdt; | ||
| 174 | 179 | ||
| 175 | SOLD("queuing primsg at end"); | 180 | SOLD("queuing primsg at end"); |
| 176 | sock = (struct sol_socket_struct *)current->files->fd[fd]->private_data; | 181 | fdt = files_fdtable(current->files); |
| 182 | sock = (struct sol_socket_struct *)fdt->fd[fd]->private_data; | ||
| 177 | it->next = NULL; | 183 | it->next = NULL; |
| 178 | if (sock->plast) | 184 | if (sock->plast) |
| 179 | sock->plast->next = it; | 185 | sock->plast->next = it; |
| @@ -344,6 +350,7 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, | |||
| 344 | char *buf; | 350 | char *buf; |
| 345 | struct file *filp; | 351 | struct file *filp; |
| 346 | struct inode *ino; | 352 | struct inode *ino; |
| 353 | struct fdtable *fdt; | ||
| 347 | struct sol_socket_struct *sock; | 354 | struct sol_socket_struct *sock; |
| 348 | mm_segment_t old_fs = get_fs(); | 355 | mm_segment_t old_fs = get_fs(); |
| 349 | long args[6]; | 356 | long args[6]; |
| @@ -351,7 +358,9 @@ int timod_putmsg(unsigned int fd, char __user *ctl_buf, int ctl_len, | |||
| 351 | (int (*)(int, unsigned long __user *))SYS(socketcall); | 358 | (int (*)(int, unsigned long __user *))SYS(socketcall); |
| 352 | int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = | 359 | int (*sys_sendto)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int) = |
| 353 | (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); | 360 | (int (*)(int, void __user *, size_t, unsigned, struct sockaddr __user *, int))SYS(sendto); |
| 354 | filp = current->files->fd[fd]; | 361 | |
| 362 | fdt = files_fdtable(current->files); | ||
| 363 | filp = fdt->fd[fd]; | ||
| 355 | ino = filp->f_dentry->d_inode; | 364 | ino = filp->f_dentry->d_inode; |
| 356 | sock = (struct sol_socket_struct *)filp->private_data; | 365 | sock = (struct sol_socket_struct *)filp->private_data; |
| 357 | SOLD("entry"); | 366 | SOLD("entry"); |
| @@ -620,6 +629,7 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us | |||
| 620 | int oldflags; | 629 | int oldflags; |
| 621 | struct file *filp; | 630 | struct file *filp; |
| 622 | struct inode *ino; | 631 | struct inode *ino; |
| 632 | struct fdtable *fdt; | ||
| 623 | struct sol_socket_struct *sock; | 633 | struct sol_socket_struct *sock; |
| 624 | struct T_unitdata_ind udi; | 634 | struct T_unitdata_ind udi; |
| 625 | mm_segment_t old_fs = get_fs(); | 635 | mm_segment_t old_fs = get_fs(); |
| @@ -632,7 +642,8 @@ int timod_getmsg(unsigned int fd, char __user *ctl_buf, int ctl_maxlen, s32 __us | |||
| 632 | 642 | ||
| 633 | SOLD("entry"); | 643 | SOLD("entry"); |
| 634 | SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); | 644 | SOLDD(("%u %p %d %p %p %d %p %d\n", fd, ctl_buf, ctl_maxlen, ctl_len, data_buf, data_maxlen, data_len, *flags_p)); |
| 635 | filp = current->files->fd[fd]; | 645 | fdt = files_fdtable(current->files); |
| 646 | filp = fdt->fd[fd]; | ||
| 636 | ino = filp->f_dentry->d_inode; | 647 | ino = filp->f_dentry->d_inode; |
| 637 | sock = (struct sol_socket_struct *)filp->private_data; | 648 | sock = (struct sol_socket_struct *)filp->private_data; |
| 638 | SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); | 649 | SOLDD(("%p %p\n", sock->pfirst, sock->pfirst ? sock->pfirst->next : NULL)); |
| @@ -844,12 +855,14 @@ asmlinkage int solaris_getmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) | |||
| 844 | int __user *flgptr; | 855 | int __user *flgptr; |
| 845 | int flags; | 856 | int flags; |
| 846 | int error = -EBADF; | 857 | int error = -EBADF; |
| 858 | struct fdtable *fdt; | ||
| 847 | 859 | ||
| 848 | SOLD("entry"); | 860 | SOLD("entry"); |
| 849 | lock_kernel(); | 861 | lock_kernel(); |
| 850 | if(fd >= NR_OPEN) goto out; | 862 | if(fd >= NR_OPEN) goto out; |
| 851 | 863 | ||
| 852 | filp = current->files->fd[fd]; | 864 | fdt = files_fdtable(current->files); |
| 865 | filp = fdt->fd[fd]; | ||
| 853 | if(!filp) goto out; | 866 | if(!filp) goto out; |
| 854 | 867 | ||
| 855 | ino = filp->f_dentry->d_inode; | 868 | ino = filp->f_dentry->d_inode; |
| @@ -910,12 +923,14 @@ asmlinkage int solaris_putmsg(unsigned int fd, u32 arg1, u32 arg2, u32 arg3) | |||
| 910 | struct strbuf ctl, dat; | 923 | struct strbuf ctl, dat; |
| 911 | int flags = (int) arg3; | 924 | int flags = (int) arg3; |
| 912 | int error = -EBADF; | 925 | int error = -EBADF; |
| 926 | struct fdtable *fdt; | ||
| 913 | 927 | ||
| 914 | SOLD("entry"); | 928 | SOLD("entry"); |
| 915 | lock_kernel(); | 929 | lock_kernel(); |
| 916 | if(fd >= NR_OPEN) goto out; | 930 | if(fd >= NR_OPEN) goto out; |
| 917 | 931 | ||
| 918 | filp = current->files->fd[fd]; | 932 | fdt = files_fdtable(current->files); |
| 933 | filp = fdt->fd[fd]; | ||
| 919 | if(!filp) goto out; | 934 | if(!filp) goto out; |
| 920 | 935 | ||
| 921 | ino = filp->f_dentry->d_inode; | 936 | ino = filp->f_dentry->d_inode; |
