Commit 5b23136b authored by Jean-Mickael Guerin's avatar Jean-Mickael Guerin Committed by David S. Miller

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: default avatarJean-Mickael Guerin <jean-mickael.guerin@6wind.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d7256d0e
...@@ -758,9 +758,13 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg, ...@@ -758,9 +758,13 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
{ {
int datagrams; int datagrams;
struct timespec ktspec; struct timespec ktspec;
struct compat_timespec __user *utspec = struct compat_timespec __user *utspec;
(struct compat_timespec __user *)timeout;
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) || if (get_user(ktspec.tv_sec, &utspec->tv_sec) ||
get_user(ktspec.tv_nsec, &utspec->tv_nsec)) get_user(ktspec.tv_nsec, &utspec->tv_nsec))
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment