diff options
-rw-r--r-- | include/net/compat.h | 2 | ||||
-rw-r--r-- | net/compat.c | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/include/net/compat.h b/include/net/compat.h index 3c7d4e38fa1d..28d5428ec6a2 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -46,7 +46,7 @@ extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsi | |||
46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); | 46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); |
47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, | 47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, |
48 | unsigned, unsigned, | 48 | unsigned, unsigned, |
49 | struct timespec __user *); | 49 | struct compat_timespec __user *); |
50 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); | 50 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); |
51 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); | 51 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); |
52 | 52 | ||
diff --git a/net/compat.c b/net/compat.c index e1a56ade803b..c4d9131a5872 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -754,26 +754,24 @@ asmlinkage long compat_sys_recvfrom(int fd, void __user *buf, size_t len, | |||
754 | 754 | ||
755 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | 755 | asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, |
756 | unsigned vlen, unsigned int flags, | 756 | unsigned vlen, unsigned int flags, |
757 | struct timespec __user *timeout) | 757 | struct compat_timespec __user *timeout) |
758 | { | 758 | { |
759 | int datagrams; | 759 | int datagrams; |
760 | struct timespec ktspec; | 760 | struct timespec ktspec; |
761 | struct compat_timespec __user *utspec; | ||
762 | 761 | ||
763 | if (timeout == NULL) | 762 | if (timeout == NULL) |
764 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | 763 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
765 | flags | MSG_CMSG_COMPAT, NULL); | 764 | flags | MSG_CMSG_COMPAT, NULL); |
766 | 765 | ||
767 | utspec = (struct compat_timespec __user *)timeout; | 766 | if (get_user(ktspec.tv_sec, &timeout->tv_sec) || |
768 | if (get_user(ktspec.tv_sec, &utspec->tv_sec) || | 767 | get_user(ktspec.tv_nsec, &timeout->tv_nsec)) |
769 | get_user(ktspec.tv_nsec, &utspec->tv_nsec)) | ||
770 | return -EFAULT; | 768 | return -EFAULT; |
771 | 769 | ||
772 | datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | 770 | datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, |
773 | flags | MSG_CMSG_COMPAT, &ktspec); | 771 | flags | MSG_CMSG_COMPAT, &ktspec); |
774 | if (datagrams > 0 && | 772 | if (datagrams > 0 && |
775 | (put_user(ktspec.tv_sec, &utspec->tv_sec) || | 773 | (put_user(ktspec.tv_sec, &timeout->tv_sec) || |
776 | put_user(ktspec.tv_nsec, &utspec->tv_nsec))) | 774 | put_user(ktspec.tv_nsec, &timeout->tv_nsec))) |
777 | datagrams = -EFAULT; | 775 | datagrams = -EFAULT; |
778 | 776 | ||
779 | return datagrams; | 777 | return datagrams; |