summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Mickael Guerin <jean-mickael.guerin@6wind.com>2009-12-01 10:52:16 +0300
committerDavid S. Miller <davem@davemloft.net>2009-12-02 12:23:23 +0300
commit5b23136bcf766a58160a319677b366c90f0cd223 (patch)
treeda895eecddb4ca3d6a14217917e2193eaca609ea
parentd7256d0eb4c82b789125f610fea11c6e82b1bcff (diff)
downloadlinux-5b23136bcf766a58160a319677b366c90f0cd223.tar.xz
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>
-rw-r--r--net/compat.c8
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,
{
int datagrams;
struct timespec ktspec;
- struct compat_timespec __user *utspec =
- (struct compat_timespec __user *)timeout;
+ struct compat_timespec __user *utspec;
+ if (timeout == NULL)
+ return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+ flags | MSG_CMSG_COMPAT, NULL);
+
+ utspec = (struct compat_timespec __user *)timeout;
if (get_user(ktspec.tv_sec, &utspec->tv_sec) ||
get_user(ktspec.tv_nsec, &utspec->tv_nsec))
return -EFAULT;