diff options
author | Jean-Mickael Guerin <jean-mickael.guerin@6wind.com> | 2009-12-01 02:52:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-02 04:23:23 -0500 |
commit | 5b23136bcf766a58160a319677b366c90f0cd223 (patch) | |
tree | da895eecddb4ca3d6a14217917e2193eaca609ea /net/compat.c | |
parent | d7256d0eb4c82b789125f610fea11c6e82b1bcff (diff) |
net: compat_sys_recvmmsg user timespec arg can be NULL
We must test if user timespec is non-NULL before copying from userpace,
same as sys_recvmmsg().
Commiter note: changed it so that we have just one branch.
Signed-off-by: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/compat.c')
-rw-r--r-- | net/compat.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/compat.c b/net/compat.c index 6a2f75fb3f45..e1a56ade803b 100644 --- a/net/compat.c +++ b/net/compat.c | |||
@@ -758,9 +758,13 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, | |||
758 | { | 758 | { |
759 | int datagrams; | 759 | int datagrams; |
760 | struct timespec ktspec; | 760 | struct timespec ktspec; |
761 | struct compat_timespec __user *utspec = | 761 | struct compat_timespec __user *utspec; |
762 | (struct compat_timespec __user *)timeout; | ||
763 | 762 | ||
763 | if (timeout == NULL) | ||
764 | return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen, | ||
765 | flags | MSG_CMSG_COMPAT, NULL); | ||
766 | |||
767 | utspec = (struct compat_timespec __user *)timeout; | ||
764 | if (get_user(ktspec.tv_sec, &utspec->tv_sec) || | 768 | if (get_user(ktspec.tv_sec, &utspec->tv_sec) || |
765 | get_user(ktspec.tv_nsec, &utspec->tv_nsec)) | 769 | get_user(ktspec.tv_nsec, &utspec->tv_nsec)) |
766 | return -EFAULT; | 770 | return -EFAULT; |