diff options
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/net/compat.c b/net/compat.c index a407c3addbae..a1fb1b079a82 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -390,9 +390,6 @@ asmlinkage long compat_sys_setsockopt(int fd, int level, int optname, | |||
390 | int err; | 390 | int err; |
391 | struct socket *sock; | 391 | struct socket *sock; |
392 | 392 | ||
393 | if (optlen < 0) | ||
394 | return -EINVAL; | ||
395 | |||
396 | if ((sock = sockfd_lookup(fd, &err))!=NULL) | 393 | if ((sock = sockfd_lookup(fd, &err))!=NULL) |
397 | { | 394 | { |
398 | err = security_socket_setsockopt(sock,level,optname); | 395 | err = security_socket_setsockopt(sock,level,optname); |
@@ -727,10 +724,10 @@ EXPORT_SYMBOL(compat_mc_getsockopt); | |||
727 | 724 | ||
728 | /* Argument list sizes for compat_sys_socketcall */ | 725 | /* Argument list sizes for compat_sys_socketcall */ |
729 | #define AL(x) ((x) * sizeof(u32)) | 726 | #define AL(x) ((x) * sizeof(u32)) |
730 | static unsigned char nas[19]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), | 727 | static unsigned char nas[20]={AL(0),AL(3),AL(3),AL(3),AL(2),AL(3), |
731 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), | 728 | AL(3),AL(3),AL(4),AL(4),AL(4),AL(6), |
732 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), | 729 | AL(6),AL(2),AL(5),AL(5),AL(3),AL(3), |
733 | AL(4)}; | 730 | AL(4),AL(5)}; |
734 | #undef AL | 731 | #undef AL |
735 | 732 | ||
736 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) | 733 | asmlinkage long compat_sys_sendmsg(int fd, struct compat_msghdr __user *msg, unsigned flags) |
@@ -755,13 +752,35 @@ asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, | |||
755 | return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen); | 752 | return sys_recvfrom(fd, buf, len, flags | MSG_CMSG_COMPAT, addr, addrlen); |
756 | } | 753 | } |
757 | 754 | ||
755 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | ||
756 | unsigned vlen, unsigned int flags, | ||
757 | struct compat_timespec __user *timeout) | ||
758 | { | ||
759 | int datagrams; | ||
760 | struct timespec ktspec; | ||
761 | |||
762 | if (timeout == NULL) | ||
763 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | ||
764 | flags | MSG_CMSG_COMPAT, NULL); | ||
765 | |||
766 | if (get_compat_timespec(&ktspec, timeout)) | ||
767 | return -EFAULT; | ||
768 | |||
769 | datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | ||
770 | flags | MSG_CMSG_COMPAT, &ktspec); | ||
771 | if (datagrams > 0 && put_compat_timespec(&ktspec, timeout)) | ||
772 | datagrams = -EFAULT; | ||
773 | |||
774 | return datagrams; | ||
775 | } | ||
776 | |||
758 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | 777 | asmlinkage long compat_sys_socketcall(int call, u32 __user *args) |
759 | { | 778 | { |
760 | int ret; | 779 | int ret; |
761 | u32 a[6]; | 780 | u32 a[6]; |
762 | u32 a0, a1; | 781 | u32 a0, a1; |
763 | 782 | ||
764 | if (call < SYS_SOCKET || call > SYS_ACCEPT4) | 783 | if (call < SYS_SOCKET || call > SYS_RECVMMSG) |
765 | return -EINVAL; | 784 | return -EINVAL; |
766 | if (copy_from_user(a, args, nas[call])) | 785 | if (copy_from_user(a, args, nas[call])) |
767 | return -EFAULT; | 786 | return -EFAULT; |
@@ -823,6 +842,10 @@ asmlinkage long compat_sys_socketcall(int call, u32 __user *args) | |||
823 | case SYS_RECVMSG: | 842 | case SYS_RECVMSG: |
824 | ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]); | 843 | ret = compat_sys_recvmsg(a0, compat_ptr(a1), a[2]); |
825 | break; | 844 | break; |
845 | case SYS_RECVMMSG: | ||
846 | ret = compat_sys_recvmmsg(a0, compat_ptr(a1), a[2], a[3], | ||
847 | compat_ptr(a[4])); | ||
848 | break; | ||
826 | case SYS_ACCEPT4: | 849 | case SYS_ACCEPT4: |
827 | ret = sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), a[3]); | 850 | ret = sys_accept4(a0, compat_ptr(a1), compat_ptr(a[2]), a[3]); |
828 | break; | 851 | break; |