diff options
author | David S. Miller <davem@davemloft.net> | 2008-11-20 19:44:00 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 19:44:00 -0500 |
commit | 6ab33d51713d6d60c7677c0d020910a8cb37e513 (patch) | |
tree | 546c2ff099b2757e75cf34ddace874f1220f740e /net/socket.c | |
parent | 7be6065b39c3f1cfa796667eac1a2170465acc91 (diff) | |
parent | 13d428afc007fcfcd6deeb215618f54cf9c0cae6 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/ixgbe/ixgbe_main.c
include/net/mac80211.h
net/phonet/af_phonet.c
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 80 |
1 files changed, 10 insertions, 70 deletions
diff --git a/net/socket.c b/net/socket.c index d7128b761c8c..e9d65ea2687e 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -1425,8 +1425,8 @@ asmlinkage long sys_listen(int fd, int backlog) | |||
1425 | * clean when we restucture accept also. | 1425 | * clean when we restucture accept also. |
1426 | */ | 1426 | */ |
1427 | 1427 | ||
1428 | long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, | 1428 | asmlinkage long sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, |
1429 | int __user *upeer_addrlen, int flags) | 1429 | int __user *upeer_addrlen, int flags) |
1430 | { | 1430 | { |
1431 | struct socket *sock, *newsock; | 1431 | struct socket *sock, *newsock; |
1432 | struct file *newfile; | 1432 | struct file *newfile; |
@@ -1509,66 +1509,10 @@ out_fd: | |||
1509 | goto out_put; | 1509 | goto out_put; |
1510 | } | 1510 | } |
1511 | 1511 | ||
1512 | #if 0 | ||
1513 | #ifdef HAVE_SET_RESTORE_SIGMASK | ||
1514 | asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
1515 | int __user *upeer_addrlen, | ||
1516 | const sigset_t __user *sigmask, | ||
1517 | size_t sigsetsize, int flags) | ||
1518 | { | ||
1519 | sigset_t ksigmask, sigsaved; | ||
1520 | int ret; | ||
1521 | |||
1522 | if (sigmask) { | ||
1523 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
1524 | if (sigsetsize != sizeof(sigset_t)) | ||
1525 | return -EINVAL; | ||
1526 | if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask))) | ||
1527 | return -EFAULT; | ||
1528 | |||
1529 | sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
1530 | sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved); | ||
1531 | } | ||
1532 | |||
1533 | ret = do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); | ||
1534 | |||
1535 | if (ret < 0 && signal_pending(current)) { | ||
1536 | /* | ||
1537 | * Don't restore the signal mask yet. Let do_signal() deliver | ||
1538 | * the signal on the way back to userspace, before the signal | ||
1539 | * mask is restored. | ||
1540 | */ | ||
1541 | if (sigmask) { | ||
1542 | memcpy(¤t->saved_sigmask, &sigsaved, | ||
1543 | sizeof(sigsaved)); | ||
1544 | set_restore_sigmask(); | ||
1545 | } | ||
1546 | } else if (sigmask) | ||
1547 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | ||
1548 | |||
1549 | return ret; | ||
1550 | } | ||
1551 | #else | ||
1552 | asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr, | ||
1553 | int __user *upeer_addrlen, | ||
1554 | const sigset_t __user *sigmask, | ||
1555 | size_t sigsetsize, int flags) | ||
1556 | { | ||
1557 | /* The platform does not support restoring the signal mask in the | ||
1558 | * return path. So we do not allow using paccept() with a signal | ||
1559 | * mask. */ | ||
1560 | if (sigmask) | ||
1561 | return -EINVAL; | ||
1562 | |||
1563 | return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags); | ||
1564 | } | ||
1565 | #endif | ||
1566 | #endif | ||
1567 | |||
1568 | asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, | 1512 | asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, |
1569 | int __user *upeer_addrlen) | 1513 | int __user *upeer_addrlen) |
1570 | { | 1514 | { |
1571 | return do_accept(fd, upeer_sockaddr, upeer_addrlen, 0); | 1515 | return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0); |
1572 | } | 1516 | } |
1573 | 1517 | ||
1574 | /* | 1518 | /* |
@@ -2095,7 +2039,7 @@ static const unsigned char nargs[19]={ | |||
2095 | AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 2039 | AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), |
2096 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 2040 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), |
2097 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), | 2041 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), |
2098 | AL(6) | 2042 | AL(4) |
2099 | }; | 2043 | }; |
2100 | 2044 | ||
2101 | #undef AL | 2045 | #undef AL |
@@ -2114,7 +2058,7 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2114 | unsigned long a0, a1; | 2058 | unsigned long a0, a1; |
2115 | int err; | 2059 | int err; |
2116 | 2060 | ||
2117 | if (call < 1 || call > SYS_PACCEPT) | 2061 | if (call < 1 || call > SYS_ACCEPT4) |
2118 | return -EINVAL; | 2062 | return -EINVAL; |
2119 | 2063 | ||
2120 | /* copy_from_user should be SMP safe. */ | 2064 | /* copy_from_user should be SMP safe. */ |
@@ -2142,9 +2086,8 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2142 | err = sys_listen(a0, a1); | 2086 | err = sys_listen(a0, a1); |
2143 | break; | 2087 | break; |
2144 | case SYS_ACCEPT: | 2088 | case SYS_ACCEPT: |
2145 | err = | 2089 | err = sys_accept4(a0, (struct sockaddr __user *)a1, |
2146 | do_accept(a0, (struct sockaddr __user *)a1, | 2090 | (int __user *)a[2], 0); |
2147 | (int __user *)a[2], 0); | ||
2148 | break; | 2091 | break; |
2149 | case SYS_GETSOCKNAME: | 2092 | case SYS_GETSOCKNAME: |
2150 | err = | 2093 | err = |
@@ -2191,12 +2134,9 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args) | |||
2191 | case SYS_RECVMSG: | 2134 | case SYS_RECVMSG: |
2192 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); | 2135 | err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); |
2193 | break; | 2136 | break; |
2194 | case SYS_PACCEPT: | 2137 | case SYS_ACCEPT4: |
2195 | err = | 2138 | err = sys_accept4(a0, (struct sockaddr __user *)a1, |
2196 | sys_paccept(a0, (struct sockaddr __user *)a1, | 2139 | (int __user *)a[2], a[3]); |
2197 | (int __user *)a[2], | ||
2198 | (const sigset_t __user *) a[3], | ||
2199 | a[4], a[5]); | ||
2200 | break; | 2140 | break; |
2201 | default: | 2141 | default: |
2202 | err = -EINVAL; | 2142 | err = -EINVAL; |