diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/trans_fd.c | 2 | ||||
-rw-r--r-- | net/compat.c | 52 | ||||
-rw-r--r-- | net/core/dev.c | 4 | ||||
-rw-r--r-- | net/core/user_dma.c | 1 | ||||
-rw-r--r-- | net/iucv/iucv.c | 2 | ||||
-rw-r--r-- | net/sctp/socket.c | 2 | ||||
-rw-r--r-- | net/socket.c | 142 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 3 |
8 files changed, 177 insertions, 31 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 4507f744f44e..cdf137af7adc 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -1285,7 +1285,7 @@ static int p9_socket_open(struct p9_trans *trans, struct socket *csocket) | |||
1285 | int fd, ret; | 1285 | int fd, ret; |
1286 | 1286 | ||
1287 | csocket->sk->sk_allocation = GFP_NOIO; | 1287 | csocket->sk->sk_allocation = GFP_NOIO; |
1288 | fd = sock_map_fd(csocket); | 1288 | fd = sock_map_fd(csocket, 0); |
1289 | if (fd < 0) { | 1289 | if (fd < 0) { |
1290 | P9_EPRINTK(KERN_ERR, "p9_socket_open: failed to map fd\n"); | 1290 | P9_EPRINTK(KERN_ERR, "p9_socket_open: failed to map fd\n"); |
1291 | return fd; | 1291 | return fd; |
diff --git a/net/compat.c b/net/compat.c index 6e1b03b51933..67fb6a3834a3 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -722,9 +722,10 @@ EXPORT_SYMBOL(compat_mc_getsockopt); | |||
722 | 722 | ||
723 | /* Argument list sizes for compat_sys_socketcall */ | 723 | /* Argument list sizes for compat_sys_socketcall */ |
724 | #define AL(x) ((x) * sizeof(u32)) | 724 | #define AL(x) ((x) * sizeof(u32)) |
725 | static unsigned char nas[18]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 725 | static unsigned char nas[19]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), |
726 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 726 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), |
727 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3)}; | 727 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), |
728 | AL(6)}; | ||
728 | #undef AL | 729 | #undef AL |
729 | 730 | ||
730 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) | 731 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) |
@@ -737,13 +738,52 @@ asmlinkage long compat_sys_recvmsg(int fd, struct compat_msghdr __user *msg, uns | |||
737 | return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); | 738 | return sys_recvmsg(fd, (struct msghdr __user *)msg, flags | MSG_CMSG_COMPAT); |
738 | } | 739 | } |
739 | 740 | ||
741 | asmlinkage long compat_sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
742 | int __user *upeer_addrlen, | ||
743 | const compat_sigset_t __user *sigmask, | ||
744 | compat_size_t sigsetsize, int flags) | ||
745 | { | ||
746 | compat_sigset_t ss32; | ||
747 | sigset_t ksigmask, sigsaved; | ||
748 | int ret; | ||
749 | |||
750 | if (sigmask) { | ||
751 | if (sigsetsize != sizeof(compat_sigset_t)) | ||
752 | return -EINVAL; | ||
753 | if (copy_from_user(&ss32, sigmask, sizeof(ss32))) | ||
754 | return -EFAULT; | ||
755 | sigset_from_compat(&ksigmask, &ss32); | ||
756 | |||
757 | sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
758 | sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); | ||
759 | } | ||
760 | |||
761 | ret = do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); | ||
762 | |||
763 | if (ret == -ERESTARTNOHAND) { | ||
764 | /* | ||
765 | * Don't restore the signal mask yet. Let do_signal() deliver | ||
766 | * the signal on the way back to userspace, before the signal | ||
767 | * mask is restored. | ||
768 | */ | ||
769 | if (sigmask) { | ||
770 | memcpy(¤t->saved_sigmask, &sigsaved, | ||
771 | sizeof(sigsaved)); | ||
772 | set_restore_sigmask(); | ||
773 | } | ||
774 | } else if (sigmask) | ||
775 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | ||
776 | |||
777 | return ret; | ||
778 | } | ||
779 | |||
740 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | 780 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args) |
741 | { | 781 | { |
742 | int ret; | 782 | int ret; |
743 | u32 a[6]; | 783 | u32 a[6]; |
744 | u32 a0, a1; | 784 | u32 a0, a1; |
745 | 785 | ||
746 | if (call < SYS_SOCKET || call > SYS_RECVMSG) | 786 | if (call < SYS_SOCKET || call > SYS_PACCEPT) |
747 | return -EINVAL; | 787 | return -EINVAL; |
748 | if (copy_from_user(a, args, nas[call])) | 788 | if (copy_from_user(a, args, nas[call])) |
749 | return -EFAULT; | 789 | return -EFAULT; |
@@ -764,7 +804,7 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | |||
764 | ret = sys_listen(a0, a1); | 804 | ret = sys_listen(a0, a1); |
765 | break; | 805 | break; |
766 | case SYS_ACCEPT: | 806 | case SYS_ACCEPT: |
767 | ret = sys_accept(a0, compat_ptr(a1), compat_ptr(a[2])); | 807 | ret = do_accept(a0, compat_ptr(a1), compat_ptr(a[2]), 0); |
768 | break; | 808 | break; |
769 | case SYS_GETSOCKNAME: | 809 | case SYS_GETSOCKNAME: |
770 | ret = sys_getsockname(a0, compat_ptr(a1), compat_ptr(a[2])); | 810 | ret = sys_getsockname(a0, compat_ptr(a1), compat_ptr(a[2])); |
@@ -804,6 +844,10 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | |||
804 | case SYS_RECVMSG: | 844 | case SYS_RECVMSG: |
805 | ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]); | 845 | ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]); |
806 | break; | 846 | break; |
847 | case SYS_PACCEPT: | ||
848 | ret = compat_sys_paccept(a0, compat_ptr(a1), compat_ptr(a[2]), | ||
849 | compat_ptr(a[3]), a[4], a[5]); | ||
850 | break; | ||
807 | default: | 851 | default: |
808 | ret = -EINVAL; | 852 | ret = -EINVAL; |
809 | break; | 853 | break; |
diff --git a/net/core/dev.c b/net/core/dev.c index ccf97f9f37eb..53af7841018a 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2395,7 +2395,7 @@ out: | |||
2395 | */ | 2395 | */ |
2396 | if (!cpus_empty(net_dma.channel_mask)) { | 2396 | if (!cpus_empty(net_dma.channel_mask)) { |
2397 | int chan_idx; | 2397 | int chan_idx; |
2398 | for_each_cpu_mask(chan_idx, net_dma.channel_mask) { | 2398 | for_each_cpu_mask_nr(chan_idx, net_dma.channel_mask) { |
2399 | struct dma_chan *chan = net_dma.channels[chan_idx]; | 2399 | struct dma_chan *chan = net_dma.channels[chan_idx]; |
2400 | if (chan) | 2400 | if (chan) |
2401 | dma_async_memcpy_issue_pending(chan); | 2401 | dma_async_memcpy_issue_pending(chan); |
@@ -4530,7 +4530,7 @@ static void net_dma_rebalance(struct net_dma *net_dma) | |||
4530 | i = 0; | 4530 | i = 0; |
4531 | cpu = first_cpu(cpu_online_map); | 4531 | cpu = first_cpu(cpu_online_map); |
4532 | 4532 | ||
4533 | for_each_cpu_mask(chan_idx, net_dma->channel_mask) { | 4533 | for_each_cpu_mask_nr(chan_idx, net_dma->channel_mask) { |
4534 | chan = net_dma->channels[chan_idx]; | 4534 | chan = net_dma->channels[chan_idx]; |
4535 | 4535 | ||
4536 | n = ((num_online_cpus() / cpus_weight(net_dma->channel_mask)) | 4536 | n = ((num_online_cpus() / cpus_weight(net_dma->channel_mask)) |
diff --git a/net/core/user_dma.c b/net/core/user_dma.c index c77aff9c6eb3..8c6b706963ff 100644 --- a/net/core/user_dma.c +++ b/net/core/user_dma.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #define NET_DMA_DEFAULT_COPYBREAK 4096 | 34 | #define NET_DMA_DEFAULT_COPYBREAK 4096 |
35 | 35 | ||
36 | int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK; | 36 | int sysctl_tcp_dma_copybreak = NET_DMA_DEFAULT_COPYBREAK; |
37 | EXPORT_SYMBOL(sysctl_tcp_dma_copybreak); | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * dma_skb_copy_datagram_iovec - Copy a datagram to an iovec. | 40 | * dma_skb_copy_datagram_iovec - Copy a datagram to an iovec. |
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c index 265b1b289a32..705959b31e24 100644 --- a/net/iucv/iucv.c +++ b/net/iucv/iucv.c | |||
@@ -497,7 +497,7 @@ static void iucv_setmask_up(void) | |||
497 | /* Disable all cpu but the first in cpu_irq_cpumask. */ | 497 | /* Disable all cpu but the first in cpu_irq_cpumask. */ |
498 | cpumask = iucv_irq_cpumask; | 498 | cpumask = iucv_irq_cpumask; |
499 | cpu_clear(first_cpu(iucv_irq_cpumask), cpumask); | 499 | cpu_clear(first_cpu(iucv_irq_cpumask), cpumask); |
500 | for_each_cpu_mask(cpu, cpumask) | 500 | for_each_cpu_mask_nr(cpu, cpumask) |
501 | smp_call_function_single(cpu, iucv_block_cpu, NULL, 1); | 501 | smp_call_function_single(cpu, iucv_block_cpu, NULL, 1); |
502 | } | 502 | } |
503 | 503 | ||
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 79bece16aede..dbb79adf8f3c 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -3910,7 +3910,7 @@ static int sctp_getsockopt_peeloff(struct sock *sk, int len, char __user *optval | |||
3910 | goto out; | 3910 | goto out; |
3911 | 3911 | ||
3912 | /* Map the socket to an unused fd that can be returned to the user. */ | 3912 | /* Map the socket to an unused fd that can be returned to the user. */ |
3913 | retval = sock_map_fd(newsock); | 3913 | retval = sock_map_fd(newsock, 0); |
3914 | if (retval < 0) { | 3914 | if (retval < 0) { |
3915 | sock_release(newsock); | 3915 | sock_release(newsock); |
3916 | goto out; | 3916 | goto out; |
diff --git a/net/socket.c b/net/socket.c index 1ba57d888981..1310a82cbba7 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -63,11 +63,13 @@ | |||
63 | #include <linux/file.h> | 63 | #include <linux/file.h> |
64 | #include <linux/net.h> | 64 | #include <linux/net.h> |
65 | #include <linux/interrupt.h> | 65 | #include <linux/interrupt.h> |
66 | #include <linux/thread_info.h> | ||
66 | #include <linux/rcupdate.h> | 67 | #include <linux/rcupdate.h> |
67 | #include <linux/netdevice.h> | 68 | #include <linux/netdevice.h> |
68 | #include <linux/proc_fs.h> | 69 | #include <linux/proc_fs.h> |
69 | #include <linux/seq_file.h> | 70 | #include <linux/seq_file.h> |
70 | #include <linux/mutex.h> | 71 | #include <linux/mutex.h> |
72 | #include <linux/thread_info.h> | ||
71 | #include <linux/wanrouter.h> | 73 | #include <linux/wanrouter.h> |
72 | #include <linux/if_bridge.h> | 74 | #include <linux/if_bridge.h> |
73 | #include <linux/if_frad.h> | 75 | #include <linux/if_frad.h> |
@@ -349,11 +351,11 @@ static struct dentry_operations sockfs_dentry_operations = { | |||
349 | * but we take care of internal coherence yet. | 351 | * but we take care of internal coherence yet. |
350 | */ | 352 | */ |
351 | 353 | ||
352 | static int sock_alloc_fd(struct file **filep) | 354 | static int sock_alloc_fd(struct file **filep, int flags) |
353 | { | 355 | { |
354 | int fd; | 356 | int fd; |
355 | 357 | ||
356 | fd = get_unused_fd(); | 358 | fd = get_unused_fd_flags(flags); |
357 | if (likely(fd >= 0)) { | 359 | if (likely(fd >= 0)) { |
358 | struct file *file = get_empty_filp(); | 360 | struct file *file = get_empty_filp(); |
359 | 361 | ||
@@ -367,7 +369,7 @@ static int sock_alloc_fd(struct file **filep) | |||
367 | return fd; | 369 | return fd; |
368 | } | 370 | } |
369 | 371 | ||
370 | static int sock_attach_fd(struct socket *sock, struct file *file) | 372 | static int sock_attach_fd(struct socket *sock, struct file *file, int flags) |
371 | { | 373 | { |
372 | struct dentry *dentry; | 374 | struct dentry *dentry; |
373 | struct qstr name = { .name = "" }; | 375 | struct qstr name = { .name = "" }; |
@@ -389,20 +391,20 @@ static int sock_attach_fd(struct socket *sock, struct file *file) | |||
389 | init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE, | 391 | init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE, |
390 | &socket_file_ops); | 392 | &socket_file_ops); |
391 | SOCK_INODE(sock)->i_fop = &socket_file_ops; | 393 | SOCK_INODE(sock)->i_fop = &socket_file_ops; |
392 | file->f_flags = O_RDWR; | 394 | file->f_flags = O_RDWR | (flags & O_NONBLOCK); |
393 | file->f_pos = 0; | 395 | file->f_pos = 0; |
394 | file->private_data = sock; | 396 | file->private_data = sock; |
395 | 397 | ||
396 | return 0; | 398 | return 0; |
397 | } | 399 | } |
398 | 400 | ||
399 | int sock_map_fd(struct socket *sock) | 401 | int sock_map_fd(struct socket *sock, int flags) |
400 | { | 402 | { |
401 | struct file *newfile; | 403 | struct file *newfile; |
402 | int fd = sock_alloc_fd(&newfile); | 404 | int fd = sock_alloc_fd(&newfile, flags); |
403 | 405 | ||
404 | if (likely(fd >= 0)) { | 406 | if (likely(fd >= 0)) { |
405 | int err = sock_attach_fd(sock, newfile); | 407 | int err = sock_attach_fd(sock, newfile, flags); |
406 | 408 | ||
407 | if (unlikely(err < 0)) { | 409 | if (unlikely(err < 0)) { |
408 | put_filp(newfile); | 410 | put_filp(newfile); |
@@ -1218,12 +1220,27 @@ asmlinkage long sys_socket(int family, int type, int protocol) | |||
1218 | { | 1220 | { |
1219 | int retval; | 1221 | int retval; |
1220 | struct socket *sock; | 1222 | struct socket *sock; |
1223 | int flags; | ||
1224 | |||
1225 | /* Check the SOCK_* constants for consistency. */ | ||
1226 | BUILD_BUG_ON(SOCK_CLOEXEC != O_CLOEXEC); | ||
1227 | BUILD_BUG_ON((SOCK_MAX | SOCK_TYPE_MASK) != SOCK_TYPE_MASK); | ||
1228 | BUILD_BUG_ON(SOCK_CLOEXEC & SOCK_TYPE_MASK); | ||
1229 | BUILD_BUG_ON(SOCK_NONBLOCK & SOCK_TYPE_MASK); | ||
1230 | |||
1231 | flags = type & ~SOCK_TYPE_MASK; | ||
1232 | if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) | ||
1233 | return -EINVAL; | ||
1234 | type &= SOCK_TYPE_MASK; | ||
1235 | |||
1236 | if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) | ||
1237 | flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; | ||
1221 | 1238 | ||
1222 | retval = sock_create(family, type, protocol, &sock); | 1239 | retval = sock_create(family, type, protocol, &sock); |
1223 | if (retval < 0) | 1240 | if (retval < 0) |
1224 | goto out; | 1241 | goto out; |
1225 | 1242 | ||
1226 | retval = sock_map_fd(sock); | 1243 | retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK)); |
1227 | if (retval < 0) | 1244 | if (retval < 0) |
1228 | goto out_release; | 1245 | goto out_release; |
1229 | 1246 | ||
@@ -1246,6 +1263,15 @@ asmlinkage long sys_socketpair(int family, int type, int protocol, | |||
1246 | struct socket *sock1, *sock2; | 1263 | struct socket *sock1, *sock2; |
1247 | int fd1, fd2, err; | 1264 | int fd1, fd2, err; |
1248 | struct file *newfile1, *newfile2; | 1265 | struct file *newfile1, *newfile2; |
1266 | int flags; | ||
1267 | |||
1268 | flags = type & ~SOCK_TYPE_MASK; | ||
1269 | if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) | ||
1270 | return -EINVAL; | ||
1271 | type &= SOCK_TYPE_MASK; | ||
1272 | |||
1273 | if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) | ||
1274 | flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; | ||
1249 | 1275 | ||
1250 | /* | 1276 | /* |
1251 | * Obtain the first socket and check if the underlying protocol | 1277 | * Obtain the first socket and check if the underlying protocol |
@@ -1264,13 +1290,13 @@ asmlinkage long sys_socketpair(int family, int type, int protocol, | |||
1264 | if (err < 0) | 1290 | if (err < 0) |
1265 | goto out_release_both; | 1291 | goto out_release_both; |
1266 | 1292 | ||
1267 | fd1 = sock_alloc_fd(&newfile1); | 1293 | fd1 = sock_alloc_fd(&newfile1, flags & O_CLOEXEC); |
1268 | if (unlikely(fd1 < 0)) { | 1294 | if (unlikely(fd1 < 0)) { |
1269 | err = fd1; | 1295 | err = fd1; |
1270 | goto out_release_both; | 1296 | goto out_release_both; |
1271 | } | 1297 | } |
1272 | 1298 | ||
1273 | fd2 = sock_alloc_fd(&newfile2); | 1299 | fd2 = sock_alloc_fd(&newfile2, flags & O_CLOEXEC); |
1274 | if (unlikely(fd2 < 0)) { | 1300 | if (unlikely(fd2 < 0)) { |
1275 | err = fd2; | 1301 | err = fd2; |
1276 | put_filp(newfile1); | 1302 | put_filp(newfile1); |
@@ -1278,12 +1304,12 @@ asmlinkage long sys_socketpair(int family, int type, int protocol, | |||
1278 | goto out_release_both; | 1304 | goto out_release_both; |
1279 | } | 1305 | } |
1280 | 1306 | ||
1281 | err = sock_attach_fd(sock1, newfile1); | 1307 | err = sock_attach_fd(sock1, newfile1, flags & O_NONBLOCK); |
1282 | if (unlikely(err < 0)) { | 1308 | if (unlikely(err < 0)) { |
1283 | goto out_fd2; | 1309 | goto out_fd2; |
1284 | } | 1310 | } |
1285 | 1311 | ||
1286 | err = sock_attach_fd(sock2, newfile2); | 1312 | err = sock_attach_fd(sock2, newfile2, flags & O_NONBLOCK); |
1287 | if (unlikely(err < 0)) { | 1313 | if (unlikely(err < 0)) { |
1288 | fput(newfile1); | 1314 | fput(newfile1); |
1289 | goto out_fd1; | 1315 | goto out_fd1; |
@@ -1401,14 +1427,20 @@ asmlinkage long sys_listen(int fd, int backlog) | |||
1401 | * clean when we restucture accept also. | 1427 | * clean when we restucture accept also. |
1402 | */ | 1428 | */ |
1403 | 1429 | ||
1404 | asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, | 1430 | long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, |
1405 | int __user *upeer_addrlen) | 1431 | int __user *upeer_addrlen, int flags) |
1406 | { | 1432 | { |
1407 | struct socket *sock, *newsock; | 1433 | struct socket *sock, *newsock; |
1408 | struct file *newfile; | 1434 | struct file *newfile; |
1409 | int err, len, newfd, fput_needed; | 1435 | int err, len, newfd, fput_needed; |
1410 | struct sockaddr_storage address; | 1436 | struct sockaddr_storage address; |
1411 | 1437 | ||
1438 | if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) | ||
1439 | return -EINVAL; | ||
1440 | |||
1441 | if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) | ||
1442 | flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; | ||
1443 | |||
1412 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1444 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
1413 | if (!sock) | 1445 | if (!sock) |
1414 | goto out; | 1446 | goto out; |
@@ -1426,14 +1458,14 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, | |||
1426 | */ | 1458 | */ |
1427 | __module_get(newsock->ops->owner); | 1459 | __module_get(newsock->ops->owner); |
1428 | 1460 | ||
1429 | newfd = sock_alloc_fd(&newfile); | 1461 | newfd = sock_alloc_fd(&newfile, flags & O_CLOEXEC); |
1430 | if (unlikely(newfd < 0)) { | 1462 | if (unlikely(newfd < 0)) { |
1431 | err = newfd; | 1463 | err = newfd; |
1432 | sock_release(newsock); | 1464 | sock_release(newsock); |
1433 | goto out_put; | 1465 | goto out_put; |
1434 | } | 1466 | } |
1435 | 1467 | ||
1436 | err = sock_attach_fd(newsock, newfile); | 1468 | err = sock_attach_fd(newsock, newfile, flags & O_NONBLOCK); |
1437 | if (err < 0) | 1469 | if (err < 0) |
1438 | goto out_fd_simple; | 1470 | goto out_fd_simple; |
1439 | 1471 | ||
@@ -1479,6 +1511,66 @@ out_fd: | |||
1479 | goto out_put; | 1511 | goto out_put; |
1480 | } | 1512 | } |
1481 | 1513 | ||
1514 | #ifdef HAVE_SET_RESTORE_SIGMASK | ||
1515 | asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
1516 | int __user *upeer_addrlen, | ||
1517 | const sigset_t __user *sigmask, | ||
1518 | size_t sigsetsize, int flags) | ||
1519 | { | ||
1520 | sigset_t ksigmask, sigsaved; | ||
1521 | int ret; | ||
1522 | |||
1523 | if (sigmask) { | ||
1524 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
1525 | if (sigsetsize != sizeof(sigset_t)) | ||
1526 | return -EINVAL; | ||
1527 | if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask))) | ||
1528 | return -EFAULT; | ||
1529 | |||
1530 | sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
1531 | sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); | ||
1532 | } | ||
1533 | |||
1534 | ret = do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); | ||
1535 | |||
1536 | if (ret < 0 && signal_pending(current)) { | ||
1537 | /* | ||
1538 | * Don't restore the signal mask yet. Let do_signal() deliver | ||
1539 | * the signal on the way back to userspace, before the signal | ||
1540 | * mask is restored. | ||
1541 | */ | ||
1542 | if (sigmask) { | ||
1543 | memcpy(¤t->saved_sigmask, &sigsaved, | ||
1544 | sizeof(sigsaved)); | ||
1545 | set_restore_sigmask(); | ||
1546 | } | ||
1547 | } else if (sigmask) | ||
1548 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | ||
1549 | |||
1550 | return ret; | ||
1551 | } | ||
1552 | #else | ||
1553 | asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
1554 | int __user *upeer_addrlen, | ||
1555 | const sigset_t __user *sigmask, | ||
1556 | size_t sigsetsize, int flags) | ||
1557 | { | ||
1558 | /* The platform does not support restoring the signal mask in the | ||
1559 | * return path. So we do not allow using paccept() with a signal | ||
1560 | * mask. */ | ||
1561 | if (sigmask) | ||
1562 | return -EINVAL; | ||
1563 | |||
1564 | return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); | ||
1565 | } | ||
1566 | #endif | ||
1567 | |||
1568 | asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
1569 | int __user *upeer_addrlen) | ||
1570 | { | ||
1571 | return do_accept(fd, upeer_sockaddr, upeer_addrlen, 0); | ||
1572 | } | ||
1573 | |||
1482 | /* | 1574 | /* |
1483 | * Attempt to connect to a socket with the server address. The address | 1575 | * Attempt to connect to a socket with the server address. The address |
1484 | * is in user space so we verify it is OK and move it to kernel space. | 1576 | * is in user space so we verify it is OK and move it to kernel space. |
@@ -1999,10 +2091,11 @@ out: | |||
1999 | 2091 | ||
2000 | /* Argument list sizes for sys_socketcall */ | 2092 | /* Argument list sizes for sys_socketcall */ |
2001 | #define AL(x) ((x) * sizeof(unsigned long)) | 2093 | #define AL(x) ((x) * sizeof(unsigned long)) |
2002 | static const unsigned char nargs[18]={ | 2094 | static const unsigned char nargs[19]={ |
2003 | AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 2095 | AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), |
2004 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 2096 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), |
2005 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3) | 2097 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), |
2098 | AL(6) | ||
2006 | }; | 2099 | }; |
2007 | 2100 | ||
2008 | #undef AL | 2101 | #undef AL |
@@ -2021,7 +2114,7 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2021 | unsigned long a0, a1; | 2114 | unsigned long a0, a1; |
2022 | int err; | 2115 | int err; |
2023 | 2116 | ||
2024 | if (call < 1 || call > SYS_RECVMSG) | 2117 | if (call < 1 || call > SYS_PACCEPT) |
2025 | return -EINVAL; | 2118 | return -EINVAL; |
2026 | 2119 | ||
2027 | /* copy_from_user should be SMP safe. */ | 2120 | /* copy_from_user should be SMP safe. */ |
@@ -2050,8 +2143,8 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2050 | break; | 2143 | break; |
2051 | case SYS_ACCEPT: | 2144 | case SYS_ACCEPT: |
2052 | err = | 2145 | err = |
2053 | sys_accept(a0, (struct sockaddr __user *)a1, | 2146 | do_accept(a0, (struct sockaddr __user *)a1, |
2054 | (int __user *)a[2]); | 2147 | (int __user *)a[2], 0); |
2055 | break; | 2148 | break; |
2056 | case SYS_GETSOCKNAME: | 2149 | case SYS_GETSOCKNAME: |
2057 | err = | 2150 | err = |
@@ -2098,6 +2191,13 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2098 | case SYS_RECVMSG: | 2191 | case SYS_RECVMSG: |
2099 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); | 2192 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); |
2100 | break; | 2193 | break; |
2194 | case SYS_PACCEPT: | ||
2195 | err = | ||
2196 | sys_paccept(a0, (struct sockaddr __user *)a1, | ||
2197 | (int __user *)a[2], | ||
2198 | (const sigset_t __user *) a[3], | ||
2199 | a[4], a[5]); | ||
2200 | break; | ||
2101 | default: | 2201 | default: |
2102 | err = -EINVAL; | 2202 | err = -EINVAL; |
2103 | break; | 2203 | break; |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 5a32cb7c4bb4..835d27413083 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -310,7 +310,8 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx) | |||
310 | switch (m->mode) { | 310 | switch (m->mode) { |
311 | case SVC_POOL_PERCPU: | 311 | case SVC_POOL_PERCPU: |
312 | { | 312 | { |
313 | set_cpus_allowed_ptr(task, &cpumask_of_cpu(node)); | 313 | cpumask_of_cpu_ptr(cpumask, node); |
314 | set_cpus_allowed_ptr(task, cpumask); | ||
314 | break; | 315 | break; |
315 | } | 316 | } |
316 | case SVC_POOL_PERNODE: | 317 | case SVC_POOL_PERNODE: |