Lines Matching refs:err
219 int err; in move_addr_to_user() local
222 err = get_user(len, ulen); in move_addr_to_user()
223 if (err) in move_addr_to_user()
224 return err; in move_addr_to_user()
410 int err = sock_attach_fd(sock, newfile, flags); in sock_map_fd() local
412 if (unlikely(err < 0)) { in sock_map_fd()
415 return err; in sock_map_fd()
422 static struct socket *sock_from_file(struct file *file, int *err) in sock_from_file() argument
427 *err = -ENOTSOCK; in sock_from_file()
444 struct socket *sockfd_lookup(int fd, int *err) in sockfd_lookup() argument
451 *err = -EBADF; in sockfd_lookup()
455 sock = sock_from_file(file, err); in sockfd_lookup()
461 static struct socket *sockfd_lookup_light(int fd, int *err, int *fput_needed) in sockfd_lookup_light() argument
466 *err = -EBADF; in sockfd_lookup_light()
469 sock = sock_from_file(file, err); in sockfd_lookup_light()
556 int err; in __sock_sendmsg() local
563 err = security_socket_sendmsg(sock, msg, size); in __sock_sendmsg()
564 if (err) in __sock_sendmsg()
565 return err; in __sock_sendmsg()
567 err = sock->ops->sendmsg(iocb, sock, msg, size); in __sock_sendmsg()
569 if (err > 0) in __sock_sendmsg()
570 update_tcp_snd(current_uid(), err); in __sock_sendmsg()
572 return err; in __sock_sendmsg()
641 int err; in __sock_recvmsg() local
650 err = security_socket_recvmsg(sock, msg, size, flags); in __sock_recvmsg()
651 if (err) in __sock_recvmsg()
652 return err; in __sock_recvmsg()
654 err = sock->ops->recvmsg(iocb, sock, msg, size, flags); in __sock_recvmsg()
656 if (err > 0) in __sock_recvmsg()
657 update_tcp_rcv(current_uid(), err); in __sock_recvmsg()
659 return err; in __sock_recvmsg()
871 int pid, err; in sock_ioctl() local
878 err = dev_ioctl(net, cmd, argp); in sock_ioctl()
882 err = dev_ioctl(net, cmd, argp); in sock_ioctl()
888 err = -EFAULT; in sock_ioctl()
891 err = f_setown(sock->file, pid, 1); in sock_ioctl()
895 err = put_user(f_getown(sock->file), in sock_ioctl()
902 err = -ENOPKG; in sock_ioctl()
908 err = br_ioctl_hook(net, cmd, argp); in sock_ioctl()
913 err = -ENOPKG; in sock_ioctl()
919 err = vlan_ioctl_hook(net, argp); in sock_ioctl()
924 err = -ENOPKG; in sock_ioctl()
930 err = dlci_ioctl_hook(cmd, argp); in sock_ioctl()
934 err = sock->ops->ioctl(sock, cmd, arg); in sock_ioctl()
940 if (err == -ENOIOCTLCMD) in sock_ioctl()
941 err = dev_ioctl(net, cmd, argp); in sock_ioctl()
944 return err; in sock_ioctl()
949 int err; in sock_create_lite() local
952 err = security_socket_create(family, type, protocol, 1); in sock_create_lite()
953 if (err) in sock_create_lite()
958 err = -ENOMEM; in sock_create_lite()
963 err = security_socket_post_create(sock, family, type, protocol, 1); in sock_create_lite()
964 if (err) in sock_create_lite()
969 return err; in sock_create_lite()
1111 int err; in __sock_create() local
1138 err = security_socket_create(family, type, protocol, kern); in __sock_create()
1139 if (err) in __sock_create()
1140 return err; in __sock_create()
1170 err = -EAFNOSUPPORT; in __sock_create()
1184 err = pf->create(net, sock, protocol); in __sock_create()
1185 if (err < 0) in __sock_create()
1200 err = security_socket_post_create(sock, family, type, protocol, kern); in __sock_create()
1201 if (err) in __sock_create()
1208 err = -EAFNOSUPPORT; in __sock_create()
1214 return err; in __sock_create()
1276 int fd1, fd2, err; in SYSCALL_DEFINE4() local
1293 err = sock_create(family, type, protocol, &sock1); in SYSCALL_DEFINE4()
1294 if (err < 0) in SYSCALL_DEFINE4()
1297 err = sock_create(family, type, protocol, &sock2); in SYSCALL_DEFINE4()
1298 if (err < 0) in SYSCALL_DEFINE4()
1301 err = sock1->ops->socketpair(sock1, sock2); in SYSCALL_DEFINE4()
1302 if (err < 0) in SYSCALL_DEFINE4()
1307 err = fd1; in SYSCALL_DEFINE4()
1313 err = fd2; in SYSCALL_DEFINE4()
1319 err = sock_attach_fd(sock1, newfile1, flags & O_NONBLOCK); in SYSCALL_DEFINE4()
1320 if (unlikely(err < 0)) { in SYSCALL_DEFINE4()
1324 err = sock_attach_fd(sock2, newfile2, flags & O_NONBLOCK); in SYSCALL_DEFINE4()
1325 if (unlikely(err < 0)) { in SYSCALL_DEFINE4()
1337 err = put_user(fd1, &usockvec[0]); in SYSCALL_DEFINE4()
1338 if (!err) in SYSCALL_DEFINE4()
1339 err = put_user(fd2, &usockvec[1]); in SYSCALL_DEFINE4()
1340 if (!err) in SYSCALL_DEFINE4()
1345 return err; in SYSCALL_DEFINE4()
1352 return err; in SYSCALL_DEFINE4()
1377 int err, fput_needed; in SYSCALL_DEFINE3() local
1379 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1381 err = move_addr_to_kernel(umyaddr, addrlen, (struct sockaddr *)&address); in SYSCALL_DEFINE3()
1382 if (err >= 0) { in SYSCALL_DEFINE3()
1383 err = security_socket_bind(sock, in SYSCALL_DEFINE3()
1386 if (!err) in SYSCALL_DEFINE3()
1387 err = sock->ops->bind(sock, in SYSCALL_DEFINE3()
1393 return err; in SYSCALL_DEFINE3()
1405 int err, fput_needed; in SYSCALL_DEFINE2() local
1408 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE2()
1414 err = security_socket_listen(sock, backlog); in SYSCALL_DEFINE2()
1415 if (!err) in SYSCALL_DEFINE2()
1416 err = sock->ops->listen(sock, backlog); in SYSCALL_DEFINE2()
1420 return err; in SYSCALL_DEFINE2()
1440 int err, len, newfd, fput_needed; in SYSCALL_DEFINE4() local
1449 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE4()
1453 err = -ENFILE; in SYSCALL_DEFINE4()
1468 err = newfd; in SYSCALL_DEFINE4()
1473 err = sock_attach_fd(newsock, newfile, flags & O_NONBLOCK); in SYSCALL_DEFINE4()
1474 if (err < 0) in SYSCALL_DEFINE4()
1477 err = security_socket_accept(sock, newsock); in SYSCALL_DEFINE4()
1478 if (err) in SYSCALL_DEFINE4()
1481 err = sock->ops->accept(sock, newsock, sock->file->f_flags); in SYSCALL_DEFINE4()
1482 if (err < 0) in SYSCALL_DEFINE4()
1488 err = -ECONNABORTED; in SYSCALL_DEFINE4()
1491 err = move_addr_to_user((struct sockaddr *)&address, in SYSCALL_DEFINE4()
1493 if (err < 0) in SYSCALL_DEFINE4()
1500 err = newfd; in SYSCALL_DEFINE4()
1507 return err; in SYSCALL_DEFINE4()
1542 int err, fput_needed; in SYSCALL_DEFINE3() local
1544 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1547 err = move_addr_to_kernel(uservaddr, addrlen, (struct sockaddr *)&address); in SYSCALL_DEFINE3()
1548 if (err < 0) in SYSCALL_DEFINE3()
1551 err = in SYSCALL_DEFINE3()
1553 if (err) in SYSCALL_DEFINE3()
1556 err = sock->ops->connect(sock, (struct sockaddr *)&address, addrlen, in SYSCALL_DEFINE3()
1561 return err; in SYSCALL_DEFINE3()
1574 int len, err, fput_needed; in SYSCALL_DEFINE3() local
1576 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1580 err = security_socket_getsockname(sock); in SYSCALL_DEFINE3()
1581 if (err) in SYSCALL_DEFINE3()
1584 err = sock->ops->getname(sock, (struct sockaddr *)&address, &len, 0); in SYSCALL_DEFINE3()
1585 if (err) in SYSCALL_DEFINE3()
1587 err = move_addr_to_user((struct sockaddr *)&address, len, usockaddr, usockaddr_len); in SYSCALL_DEFINE3()
1592 return err; in SYSCALL_DEFINE3()
1605 int len, err, fput_needed; in SYSCALL_DEFINE3() local
1607 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1609 err = security_socket_getpeername(sock); in SYSCALL_DEFINE3()
1610 if (err) { in SYSCALL_DEFINE3()
1612 return err; in SYSCALL_DEFINE3()
1615 err = in SYSCALL_DEFINE3()
1618 if (!err) in SYSCALL_DEFINE3()
1619 err = move_addr_to_user((struct sockaddr *)&address, len, usockaddr, in SYSCALL_DEFINE3()
1623 return err; in SYSCALL_DEFINE3()
1638 int err; in SYSCALL_DEFINE6() local
1643 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE6()
1656 err = move_addr_to_kernel(addr, addr_len, (struct sockaddr *)&address); in SYSCALL_DEFINE6()
1657 if (err < 0) in SYSCALL_DEFINE6()
1665 err = sock_sendmsg(sock, &msg, len); in SYSCALL_DEFINE6()
1670 return err; in SYSCALL_DEFINE6()
1697 int err, err2; in SYSCALL_DEFINE6() local
1700 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE6()
1714 err = sock_recvmsg(sock, &msg, size, flags); in SYSCALL_DEFINE6()
1716 if (err >= 0 && addr != NULL) { in SYSCALL_DEFINE6()
1720 err = err2; in SYSCALL_DEFINE6()
1725 return err; in SYSCALL_DEFINE6()
1746 int err, fput_needed; in SYSCALL_DEFINE5() local
1752 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE5()
1754 err = security_socket_setsockopt(sock, level, optname); in SYSCALL_DEFINE5()
1755 if (err) in SYSCALL_DEFINE5()
1759 err = in SYSCALL_DEFINE5()
1763 err = in SYSCALL_DEFINE5()
1769 return err; in SYSCALL_DEFINE5()
1780 int err, fput_needed; in SYSCALL_DEFINE5() local
1783 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE5()
1785 err = security_socket_getsockopt(sock, level, optname); in SYSCALL_DEFINE5()
1786 if (err) in SYSCALL_DEFINE5()
1790 err = in SYSCALL_DEFINE5()
1794 err = in SYSCALL_DEFINE5()
1800 return err; in SYSCALL_DEFINE5()
1809 int err, fput_needed; in SYSCALL_DEFINE2() local
1812 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE2()
1814 err = security_socket_shutdown(sock, how); in SYSCALL_DEFINE2()
1815 if (!err) in SYSCALL_DEFINE2()
1816 err = sock->ops->shutdown(sock, how); in SYSCALL_DEFINE2()
1819 return err; in SYSCALL_DEFINE2()
1845 int err, ctl_len, iov_size, total_len; in SYSCALL_DEFINE3() local
1848 err = -EFAULT; in SYSCALL_DEFINE3()
1856 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1861 err = -EMSGSIZE; in SYSCALL_DEFINE3()
1866 err = -ENOMEM; in SYSCALL_DEFINE3()
1876 err = verify_compat_iovec(&msg_sys, iov, in SYSCALL_DEFINE3()
1880 err = verify_iovec(&msg_sys, iov, in SYSCALL_DEFINE3()
1883 if (err < 0) in SYSCALL_DEFINE3()
1885 total_len = err; in SYSCALL_DEFINE3()
1887 err = -ENOBUFS; in SYSCALL_DEFINE3()
1893 err = in SYSCALL_DEFINE3()
1896 if (err) in SYSCALL_DEFINE3()
1906 err = -EFAULT; in SYSCALL_DEFINE3()
1921 err = sock_sendmsg(sock, &msg_sys, total_len); in SYSCALL_DEFINE3()
1932 return err; in SYSCALL_DEFINE3()
1949 int err, iov_size, total_len, len; in SYSCALL_DEFINE3() local
1966 sock = sockfd_lookup_light(fd, &err, &fput_needed); in SYSCALL_DEFINE3()
1970 err = -EMSGSIZE; in SYSCALL_DEFINE3()
1975 err = -ENOMEM; in SYSCALL_DEFINE3()
1991 err = verify_compat_iovec(&msg_sys, iov, in SYSCALL_DEFINE3()
1995 err = verify_iovec(&msg_sys, iov, in SYSCALL_DEFINE3()
1998 if (err < 0) in SYSCALL_DEFINE3()
2000 total_len = err; in SYSCALL_DEFINE3()
2007 err = sock_recvmsg(sock, &msg_sys, total_len, flags); in SYSCALL_DEFINE3()
2008 if (err < 0) in SYSCALL_DEFINE3()
2010 len = err; in SYSCALL_DEFINE3()
2013 err = move_addr_to_user((struct sockaddr *)&addr, in SYSCALL_DEFINE3()
2016 if (err < 0) in SYSCALL_DEFINE3()
2019 err = __put_user((msg_sys.msg_flags & ~MSG_CMSG_COMPAT), in SYSCALL_DEFINE3()
2021 if (err) in SYSCALL_DEFINE3()
2024 err = __put_user((unsigned long)msg_sys.msg_control - cmsg_ptr, in SYSCALL_DEFINE3()
2027 err = __put_user((unsigned long)msg_sys.msg_control - cmsg_ptr, in SYSCALL_DEFINE3()
2029 if (err) in SYSCALL_DEFINE3()
2031 err = len; in SYSCALL_DEFINE3()
2039 return err; in SYSCALL_DEFINE3()
2067 int err; in SYSCALL_DEFINE2() local
2083 err = sys_socket(a0, a1, a[2]); in SYSCALL_DEFINE2()
2086 err = sys_bind(a0, (struct sockaddr __user *)a1, a[2]); in SYSCALL_DEFINE2()
2089 err = sys_connect(a0, (struct sockaddr __user *)a1, a[2]); in SYSCALL_DEFINE2()
2092 err = sys_listen(a0, a1); in SYSCALL_DEFINE2()
2095 err = sys_accept4(a0, (struct sockaddr __user *)a1, in SYSCALL_DEFINE2()
2099 err = in SYSCALL_DEFINE2()
2104 err = in SYSCALL_DEFINE2()
2109 err = sys_socketpair(a0, a1, a[2], (int __user *)a[3]); in SYSCALL_DEFINE2()
2112 err = sys_send(a0, (void __user *)a1, a[2], a[3]); in SYSCALL_DEFINE2()
2115 err = sys_sendto(a0, (void __user *)a1, a[2], a[3], in SYSCALL_DEFINE2()
2119 err = sys_recv(a0, (void __user *)a1, a[2], a[3]); in SYSCALL_DEFINE2()
2122 err = sys_recvfrom(a0, (void __user *)a1, a[2], a[3], in SYSCALL_DEFINE2()
2127 err = sys_shutdown(a0, a1); in SYSCALL_DEFINE2()
2130 err = sys_setsockopt(a0, a1, a[2], (char __user *)a[3], a[4]); in SYSCALL_DEFINE2()
2133 err = in SYSCALL_DEFINE2()
2138 err = sys_sendmsg(a0, (struct msghdr __user *)a1, a[2]); in SYSCALL_DEFINE2()
2141 err = sys_recvmsg(a0, (struct msghdr __user *)a1, a[2]); in SYSCALL_DEFINE2()
2144 err = sys_accept4(a0, (struct sockaddr __user *)a1, in SYSCALL_DEFINE2()
2148 err = -EINVAL; in SYSCALL_DEFINE2()
2151 return err; in SYSCALL_DEFINE2()
2167 int err; in sock_register() local
2177 err = -EEXIST; in sock_register()
2180 err = 0; in sock_register()
2185 return err; in sock_register()
2300 int err; in kernel_accept() local
2302 err = sock_create_lite(sk->sk_family, sk->sk_type, sk->sk_protocol, in kernel_accept()
2304 if (err < 0) in kernel_accept()
2307 err = sock->ops->accept(sock, *newsock, flags); in kernel_accept()
2308 if (err < 0) { in kernel_accept()
2318 return err; in kernel_accept()
2343 int err; in kernel_getsockopt() local
2347 err = sock_getsockopt(sock, level, optname, optval, optlen); in kernel_getsockopt()
2349 err = sock->ops->getsockopt(sock, level, optname, optval, in kernel_getsockopt()
2352 return err; in kernel_getsockopt()
2359 int err; in kernel_setsockopt() local
2363 err = sock_setsockopt(sock, level, optname, optval, optlen); in kernel_setsockopt()
2365 err = sock->ops->setsockopt(sock, level, optname, optval, in kernel_setsockopt()
2368 return err; in kernel_setsockopt()
2383 int err; in kernel_sock_ioctl() local
2386 err = sock->ops->ioctl(sock, cmd, arg); in kernel_sock_ioctl()
2389 return err; in kernel_sock_ioctl()