aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c83
1 files changed, 11 insertions, 72 deletions
diff --git a/net/socket.c b/net/socket.c
index 3e8d4e35c08f..92764d836891 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -990,7 +990,6 @@ static int sock_close(struct inode *inode, struct file *filp)
990 printk(KERN_DEBUG "sock_close: NULL inode\n"); 990 printk(KERN_DEBUG "sock_close: NULL inode\n");
991 return 0; 991 return 0;
992 } 992 }
993 sock_fasync(-1, filp, 0);
994 sock_release(SOCKET_I(inode)); 993 sock_release(SOCKET_I(inode));
995 return 0; 994 return 0;
996} 995}
@@ -1142,7 +1141,7 @@ static int __sock_create(struct net *net, int family, int type, int protocol,
1142 1141
1143 sock->type = type; 1142 sock->type = type;
1144 1143
1145#if defined(CONFIG_KMOD) 1144#ifdef CONFIG_MODULES
1146 /* Attempt to load a protocol module if the find failed. 1145 /* Attempt to load a protocol module if the find failed.
1147 * 1146 *
1148 * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user 1147 * 12/09/1996 Marcin: But! this makes REALLY only sense, if the user
@@ -1427,8 +1426,8 @@ asmlinkage long sys_listen(int fd, int backlog)
1427 * clean when we restucture accept also. 1426 * clean when we restucture accept also.
1428 */ 1427 */
1429 1428
1430long do_accept(int fd, struct sockaddr __user *upeer_sockaddr, 1429asmlinkage long sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr,
1431 int __user *upeer_addrlen, int flags) 1430 int __user *upeer_addrlen, int flags)
1432{ 1431{
1433 struct socket *sock, *newsock; 1432 struct socket *sock, *newsock;
1434 struct file *newfile; 1433 struct file *newfile;
@@ -1511,66 +1510,10 @@ out_fd:
1511 goto out_put; 1510 goto out_put;
1512} 1511}
1513 1512
1514#if 0
1515#ifdef HAVE_SET_RESTORE_SIGMASK
1516asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
1517 int __user *upeer_addrlen,
1518 const sigset_t __user *sigmask,
1519 size_t sigsetsize, int flags)
1520{
1521 sigset_t ksigmask, sigsaved;
1522 int ret;
1523
1524 if (sigmask) {
1525 /* XXX: Don't preclude handling different sized sigset_t's. */
1526 if (sigsetsize != sizeof(sigset_t))
1527 return -EINVAL;
1528 if (copy_from_user(&ksigmask, sigmask, sizeof(ksigmask)))
1529 return -EFAULT;
1530
1531 sigdelsetmask(&ksigmask, sigmask(SIGKILL)|sigmask(SIGSTOP));
1532 sigprocmask(SIG_SETMASK, &ksigmask, &sigsaved);
1533 }
1534
1535 ret = do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
1536
1537 if (ret < 0 && signal_pending(current)) {
1538 /*
1539 * Don't restore the signal mask yet. Let do_signal() deliver
1540 * the signal on the way back to userspace, before the signal
1541 * mask is restored.
1542 */
1543 if (sigmask) {
1544 memcpy(&current->saved_sigmask, &sigsaved,
1545 sizeof(sigsaved));
1546 set_restore_sigmask();
1547 }
1548 } else if (sigmask)
1549 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
1550
1551 return ret;
1552}
1553#else
1554asmlinkage long sys_paccept(int fd, struct sockaddr __user *upeer_sockaddr,
1555 int __user *upeer_addrlen,
1556 const sigset_t __user *sigmask,
1557 size_t sigsetsize, int flags)
1558{
1559 /* The platform does not support restoring the signal mask in the
1560 * return path. So we do not allow using paccept() with a signal
1561 * mask. */
1562 if (sigmask)
1563 return -EINVAL;
1564
1565 return do_accept(fd, upeer_sockaddr, upeer_addrlen, flags);
1566}
1567#endif
1568#endif
1569
1570asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, 1513asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr,
1571 int __user *upeer_addrlen) 1514 int __user *upeer_addrlen)
1572{ 1515{
1573 return do_accept(fd, upeer_sockaddr, upeer_addrlen, 0); 1516 return sys_accept4(fd, upeer_sockaddr, upeer_addrlen, 0);
1574} 1517}
1575 1518
1576/* 1519/*
@@ -2097,7 +2040,7 @@ static const unsigned char nargs[19]={
2097 AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), 2040 AL(0),AL(3),AL(3),AL(3),AL(2),AL(3),
2098 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), 2041 AL(3),AL(3),AL(4),AL(4),AL(4),AL(6),
2099 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), 2042 AL(6),AL(2),AL(5),AL(5),AL(3),AL(3),
2100 AL(6) 2043 AL(4)
2101}; 2044};
2102 2045
2103#undef AL 2046#undef AL
@@ -2116,7 +2059,7 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args)
2116 unsigned long a0, a1; 2059 unsigned long a0, a1;
2117 int err; 2060 int err;
2118 2061
2119 if (call < 1 || call > SYS_PACCEPT) 2062 if (call < 1 || call > SYS_ACCEPT4)
2120 return -EINVAL; 2063 return -EINVAL;
2121 2064
2122 /* copy_from_user should be SMP safe. */ 2065 /* copy_from_user should be SMP safe. */
@@ -2144,9 +2087,8 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args)
2144 err = sys_listen(a0, a1); 2087 err = sys_listen(a0, a1);
2145 break; 2088 break;
2146 case SYS_ACCEPT: 2089 case SYS_ACCEPT:
2147 err = 2090 err = sys_accept4(a0, (struct sockaddr __user *)a1,
2148 do_accept(a0, (struct sockaddr __user *)a1, 2091 (int __user *)a[2], 0);
2149 (int __user *)a[2], 0);
2150 break; 2092 break;
2151 case SYS_GETSOCKNAME: 2093 case SYS_GETSOCKNAME:
2152 err = 2094 err =
@@ -2193,12 +2135,9 @@ asmlinkage long sys_socketcall(int call, unsigned long __user *args)
2193 case SYS_RECVMSG: 2135 case SYS_RECVMSG:
2194 err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); 2136 err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]);
2195 break; 2137 break;
2196 case SYS_PACCEPT: 2138 case SYS_ACCEPT4:
2197 err = 2139 err = sys_accept4(a0, (struct sockaddr __user *)a1,
2198 sys_paccept(a0, (struct sockaddr __user *)a1, 2140 (int __user *)a[2], a[3]);
2199 (int __user *)a[2],
2200 (const sigset_t __user *) a[3],
2201 a[4], a[5]);
2202 break; 2141 break;
2203 default: 2142 default:
2204 err = -EINVAL; 2143 err = -EINVAL;